]> git.ipfire.org Git - thirdparty/squid.git/blame - src/pconn.h
Forward port of latest 2.6 changes
[thirdparty/squid.git] / src / pconn.h
CommitLineData
781ce8ff 1
2#ifndef SQUID_PCONN_H
3#define SQUID_PCONN_H
4
5#define MAX_NUM_PCONN_POOLS 10
6#define PCONN_HIST_SZ (1<<16)
7
8class PconnPool;
9
10class IdleConnList
11{
12
13public:
14 IdleConnList(const char *key, PconnPool *parent);
15 ~IdleConnList();
16 int numIdle() { return nfds; }
17
18 int findFDIndex(int fd);
19 void removeFD(int fd);
20 void push(int fd);
21 int findUseableFD();
22 void clearHandlers(int fd);
23
24private:
25 static IOCB read;
26 static PF timeout;
27
28public:
29 hash_link hash; /* must be first */
30
31private:
32 int *fds;
33 int nfds_alloc;
34 int nfds;
35 PconnPool *parent;
36 char fakeReadBuf[4096];
37 CBDATA_CLASS2(IdleConnList);
38};
39
40class PconnPool
41{
42
43public:
44 PconnPool(const char *);
45
46 void moduleInit();
47 void push(int fd, const char *host, u_short port, const char *domain);
48 int pop(const char *host, u_short port, const char *domain);
49 void count(int uses);
50 void dumpHist(StoreEntry *e);
51 void unlinkList(IdleConnList *list) const;
52
53private:
54
55 static const char *key(const char *host, u_short port, const char *domain);
56
57 int hist[PCONN_HIST_SZ];
58 hash_table *table;
59 const char *descr;
60
61};
62
63class PconnModule
64{
65
66public:
67 PconnModule();
68
69 void add
70 (PconnPool *);
71
72 OBJH dump;
73
74private:
75 PconnPool **pools;
76
77 int poolCount;
78};
79
80#endif /* SQUID_PCONN_H */