Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:39

0001 #ifndef __LINK_MATCH__
0002 #define __LINK_MATCH__
0003 /******************************************************************************/
0004 /*                                                                            */
0005 /*                       X r d L i n k M a t c h . h h                        */
0006 /*                                                                            */
0007 /* (c) 2005 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 #include <cstring>
0033   
0034 class XrdLinkMatch
0035 {
0036 public:
0037 
0038 
0039 int                Match(const char *uname, int unlen,
0040                          const char *hname, int hnlen);
0041 inline int         Match(const char *uname, int unlen,
0042                          const char *hname)
0043                         {return Match(uname, unlen, hname, strlen(hname));}
0044 
0045 // Target: [<user>][*][@[<hostpfx>][*][<hostsfx>]]
0046 //
0047        void        Set(const char *target);
0048 
0049              XrdLinkMatch(const char *target=0)
0050                          {Uname = HnameL = HnameR = 0;
0051                           Unamelen = Hnamelen = 0;
0052                           if (target) Set(target);
0053                          }
0054 
0055             ~XrdLinkMatch() {}
0056 
0057 private:
0058 
0059 char               Buff[256];
0060 int                Unamelen;
0061 char              *Uname;
0062 int                HnamelenL;
0063 char              *HnameL;
0064 int                HnamelenR;
0065 char              *HnameR;
0066 int                Hnamelen;
0067 };
0068 #endif