This file is indexed.

/usr/include/rserpool/tcplikeserver.h is in libcpprspserver-dev 3.0.1-1ubuntu6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/* $Id: tcplikeserver.h 2608 2011-11-23 07:52:38Z dreibh $
 * --------------------------------------------------------------------------
 *
 *              //===//   //=====   //===//   //       //   //===//
 *             //    //  //        //    //  //       //   //    //
 *            //===//   //=====   //===//   //       //   //===<<
 *           //   \\         //  //        //       //   //    //
 *          //     \\  =====//  //        //=====  //   //===//    Version II
 *
 * ------------- An Efficient RSerPool Prototype Implementation -------------
 *
 * Copyright (C) 2004-2012 by Thomas Dreibholz
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Contact: dreibh@iem.uni-due.de
 */

#ifndef TCPLIKESERVER_H
#define TCPLIKESERVER_H

#include "rserpool-internals.h"
#include "cpprspserver.h"
#include "thread.h"


struct TagItem;
class TCPLikeServer;

class TCPLikeServerList : public TDMutex
{
   public:
   TCPLikeServerList(size_t maxThreads, int systemNotificationPipe);
   ~TCPLikeServerList();
   bool add(TCPLikeServer* thread);
   void remove(TCPLikeServer* thread);
   size_t handleRemovalsAndTimers();
   void removeAll();

   double getTotalLoad();
   size_t getThreads();
   inline size_t getMaxThreads() const {
      return(MaxThreads);
   }
   inline bool hasCapacity() const {
      return(Threads < MaxThreads);
   }

   private:
   friend class TCPLikeServer;
   struct ThreadListEntry {
      ThreadListEntry* Next;
      TCPLikeServer*   Object;
   };
   ThreadListEntry* ThreadList;
   size_t           Threads;
   size_t           MaxThreads;
   int              SystemNotificationPipe;
   unsigned int     LoadSum;
};


class TCPLikeServer : public TDThread
{
   friend class TCPLikeServerList;

   public:
   TCPLikeServer(int rserpoolSocketDescriptor);
   ~TCPLikeServer();

   inline bool hasFinished() {
      lock();
      const bool finished = Finished;
      unlock();
      return(finished);
   }
   inline bool isShuttingDown() {
      lock();
      const bool shutdown = Shutdown;
      unlock();
      return(shutdown);
   }
   inline void setSyncTimer(const unsigned long long timeStamp) {
      lock();
      SyncTimerTimeStamp = timeStamp;
      unlock();
   }
   inline void setAsyncTimer(const unsigned long long timeStamp) {
      lock();
      AsyncTimerTimeStamp = timeStamp;
      unlock();
   }
   inline TCPLikeServerList* getServerList() const {
      return(ServerList);
   }
   inline void setServerList(TCPLikeServerList* serverList) {
      ServerList = serverList;
   }
   void shutdown();

   double getLoad() const;
   void setLoad(double load);

   static void poolElement(const char*          programTitle,
                           const char*          poolHandle,
                           struct rsp_info*     info,
                           struct rsp_loadinfo* loadinfo,
                           size_t               maxThreads,
                           TCPLikeServer*       (*threadFactory)(int sd, void* userData, uint32_t peIdentifier),
                           void                 (*printParameters)(const void* userData),
                           void                 (*rejectNewSession)(int sd),
                           bool                 (*initializeService)(void* userData),
                           void                 (*finishService)(void* userData),
                           double               (*loadUpdateHook)(const double load),
                           void*                userData,
                           const sockaddr*      localAddressSet = NULL,
                           const size_t         localAddresses  = 0,
                           unsigned int         reregInterval   = 30000,
                           unsigned int         runtimeLimit    = 0,
                           const bool           quiet           = false,
                           const bool           daemonMode      = false,
                           struct TagItem*      tags            = NULL);

   protected:
   int                RSerPoolSocketDescriptor;
   TCPLikeServerList* ServerList;

   protected:
   virtual EventHandlingResult initializeSession();
   virtual void finishSession(EventHandlingResult result);
   virtual EventHandlingResult syncTimerEvent(const unsigned long long now);
   virtual void asyncTimerEvent(const unsigned long long now);
   virtual EventHandlingResult handleMessage(const char* buffer,
                                             size_t      bufferSize,
                                             uint32_t    ppid,
                                             uint16_t    streamID);
   virtual EventHandlingResult handleCookieEcho(const char* buffer, size_t bufferSize);
   virtual EventHandlingResult handleNotification(const union rserpool_notification* notification);

   private:
   void run();

   unsigned int       Load;
   bool               IsNewSession;
   bool               Shutdown;
   bool               Finished;
   unsigned long long SyncTimerTimeStamp;
   unsigned long long AsyncTimerTimeStamp;
};


#endif