|
||||
File indexing completed on 2025-01-18 10:15:38
0001 #ifndef __NET_BUFF__ 0002 #define __NET_BUFF__ 0003 /******************************************************************************/ 0004 /* */ 0005 /* X r d N e t B u f f e r . h h */ 0006 /* */ 0007 /* (c) 2003 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 <cstdlib> 0034 0035 #include "XrdOuc/XrdOucChain.hh" 0036 #include "XrdSys/XrdSysPthread.hh" 0037 0038 /******************************************************************************/ 0039 /* X r d N e t B u f f e r Q */ 0040 /******************************************************************************/ 0041 0042 class XrdNetBuffer; 0043 0044 class XrdNetBufferQ 0045 { 0046 public: 0047 0048 XrdNetBuffer *Alloc(); 0049 0050 inline int BuffSize(void) {return size;} 0051 0052 void Recycle(XrdNetBuffer *bp); 0053 0054 void Set(int maxb); 0055 0056 XrdNetBufferQ(int bsz, int maxb=16); 0057 ~XrdNetBufferQ(); 0058 0059 int alignit; 0060 XrdSysMutex BuffList; 0061 XrdOucStack<XrdNetBuffer> BuffStack; 0062 int maxbuff; 0063 int numbuff; 0064 int size; 0065 }; 0066 0067 /******************************************************************************/ 0068 /* X r d N e t B u f f e r */ 0069 /******************************************************************************/ 0070 0071 class XrdNetBuffer 0072 { 0073 friend class XrdNetBufferQ; 0074 0075 public: 0076 char *data; 0077 int dlen; 0078 0079 inline int BuffSize(void) {return BuffQ->BuffSize();} 0080 0081 void Recycle(void) {BuffQ->Recycle(this);} 0082 0083 XrdNetBuffer(XrdNetBufferQ *bq); 0084 ~XrdNetBuffer() {if (data) free(data);} 0085 0086 private: 0087 0088 XrdOucQSItem<XrdNetBuffer> BuffLink; 0089 XrdNetBufferQ *BuffQ; 0090 }; 0091 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |