~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to src/ICP.h

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2010-05-04 11:15:49 UTC
  • mfrom: (1.3.1 upstream)
  • mto: (20.3.1 squeeze) (21.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20100504111549-1apjh2g5sndki4te
Tags: upstream-3.1.3
ImportĀ upstreamĀ versionĀ 3.1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
1
/*
3
 
 * $Id: ICP.h,v 1.9 2007/10/31 04:52:15 amosjeffries Exp $
 
2
 * $Id$
4
3
 *
5
4
 *
6
5
 * SQUID Web Proxy Cache          http://www.squid-cache.org/
19
18
 *  it under the terms of the GNU General Public License as published by
20
19
 *  the Free Software Foundation; either version 2 of the License, or
21
20
 *  (at your option) any later version.
22
 
 *  
 
21
 *
23
22
 *  This program is distributed in the hope that it will be useful,
24
23
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
25
24
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
25
 *  GNU General Public License for more details.
27
 
 *  
 
26
 *
28
27
 *  You should have received a copy of the GNU General Public License
29
28
 *  along with this program; if not, write to the Free Software
30
29
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
34
33
#ifndef SQUID_ICP_H
35
34
#define SQUID_ICP_H
36
35
 
 
36
/**
 
37
 \defgroup ServerProtocolICPAPI ICP
 
38
 \ingroup ServerProtocol
 
39
 */
 
40
 
37
41
#include "StoreClient.h"
38
42
 
39
43
/**
 
44
 \ingroup ServerProtocolICPAPI
 
45
 *
40
46
 * This struct is the wire-level header.
41
47
 * DO NOT add more move fields on pain of breakage.
42
48
 * DO NOT add virtual methods.
43
49
 */
44
 
struct _icp_common_t
45
 
{
46
 
    unsigned char opcode;       /* opcode */
47
 
    unsigned char version;      /* version number */
48
 
    unsigned short length;      /* total length (bytes) */
49
 
    u_int32_t reqnum;           /* req number (req'd for UDP) */
 
50
struct _icp_common_t {
 
51
    /** opcode */
 
52
    unsigned char opcode;
 
53
    /** version number */
 
54
    unsigned char version;
 
55
    /** total length (bytes) */
 
56
    unsigned short length;
 
57
    /** req number (req'd for UDP) */
 
58
    u_int32_t reqnum;
50
59
    u_int32_t flags;
51
60
    u_int32_t pad;
52
 
    u_int32_t shostid;          /* sender host id */
 
61
    /** sender host id */
 
62
    u_int32_t shostid;
 
63
 
 
64
/// \todo I don't believe this header is included in non-c++ code anywhere
 
65
///             the struct should become a public POD class and kill these ifdef.
53
66
#ifdef __cplusplus
54
67
 
55
68
    _icp_common_t();
56
69
    _icp_common_t(char *buf, unsigned int len);
57
70
 
58
 
    void handleReply(char *buf, struct sockaddr_in *from);
 
71
    void handleReply(char *buf, IpAddress &from);
59
72
    static _icp_common_t *createMessage(icp_opcode opcode, int flags, const char *url, int reqnum, int pad);
60
73
    icp_opcode getOpCode() const;
61
74
#endif
63
76
 
64
77
#ifdef __cplusplus
65
78
 
 
79
/// \ingroup ServerProtocolICPAPI
66
80
inline icp_opcode & operator++ (icp_opcode & aCode)
67
81
{
68
82
    int tmp = (int) aCode;
71
85
}
72
86
 
73
87
 
74
 
/** \todo mempool this */
 
88
/**
 
89
 \ingroup ServerProtocolICPAPI
 
90
 \todo mempool this
 
91
 */
75
92
class ICPState
76
93
{
77
94
 
78
95
public:
79
 
    ICPState(icp_common_t &, HttpRequest *);
80
 
    virtual ~ ICPState();
 
96
    ICPState(icp_common_t &aHeader, HttpRequest *aRequest);
 
97
    virtual ~ICPState();
81
98
    icp_common_t header;
82
99
    HttpRequest *request;
83
100
    int fd;
84
101
 
85
 
    struct sockaddr_in from;
 
102
    IpAddress from;
86
103
    char *url;
87
104
};
88
105
 
89
106
#endif
90
107
 
91
 
struct icpUdpData
92
 
{
93
 
 
94
 
    struct sockaddr_in address;
 
108
/// \ingroup ServerProtocolICPAPI
 
109
struct icpUdpData {
 
110
    IpAddress address;
95
111
    void *msg;
96
112
    size_t len;
97
113
    icpUdpData *next;
105
121
    struct timeval queue_time;
106
122
};
107
123
 
108
 
 
109
 
HttpRequest* icpGetRequest(char *url, int reqnum, int fd, struct sockaddr_in *from);
110
 
 
111
 
int icpAccessAllowed(struct sockaddr_in *from, HttpRequest * icp_request);
112
 
 
113
 
SQUIDCEXTERN void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const struct sockaddr_in *from);
 
124
/// \ingroup ServerProtocolICPAPI
 
125
HttpRequest* icpGetRequest(char *url, int reqnum, int fd, IpAddress &from);
 
126
 
 
127
/// \ingroup ServerProtocolICPAPI
 
128
int icpAccessAllowed(IpAddress &from, HttpRequest * icp_request);
 
129
 
 
130
/// \ingroup ServerProtocolICPAPI
 
131
SQUIDCEXTERN void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const IpAddress &from);
 
132
 
 
133
/// \ingroup ServerProtocolICPAPI
114
134
extern icp_opcode icpGetCommonOpcode();
115
135
 
116
 
SQUIDCEXTERN int icpUdpSend(int, const struct sockaddr_in *, icp_common_t *, log_type, int);
 
136
/// \ingroup ServerProtocolICPAPI
 
137
SQUIDCEXTERN int icpUdpSend(int, const IpAddress &, icp_common_t *, log_type, int);
 
138
 
 
139
/// \ingroup ServerProtocolICPAPI
117
140
SQUIDCEXTERN log_type icpLogFromICPCode(icp_opcode opcode);
118
141
 
119
 
void icpDenyAccess(struct sockaddr_in *from, char *url, int reqnum, int fd);
 
142
/// \ingroup ServerProtocolICPAPI
 
143
void icpDenyAccess(IpAddress &from, char *url, int reqnum, int fd);
 
144
 
 
145
/// \ingroup ServerProtocolICPAPI
120
146
SQUIDCEXTERN PF icpHandleUdp;
 
147
 
 
148
/// \ingroup ServerProtocolICPAPI
121
149
SQUIDCEXTERN PF icpUdpSendQueue;
122
150
 
123
 
SQUIDCEXTERN void icpHandleIcpV3(int, struct sockaddr_in, char *, int);
 
151
/// \ingroup ServerProtocolICPAPI
 
152
SQUIDCEXTERN void icpHandleIcpV3(int, IpAddress &, char *, int);
 
153
 
 
154
/// \ingroup ServerProtocolICPAPI
124
155
SQUIDCEXTERN int icpCheckUdpHit(StoreEntry *, HttpRequest * request);
 
156
 
 
157
/// \ingroup ServerProtocolICPAPI
125
158
SQUIDCEXTERN void icpConnectionsOpen(void);
 
159
 
 
160
/// \ingroup ServerProtocolICPAPI
126
161
SQUIDCEXTERN void icpConnectionShutdown(void);
 
162
 
 
163
/// \ingroup ServerProtocolICPAPI
127
164
SQUIDCEXTERN void icpConnectionClose(void);
 
165
 
 
166
/// \ingroup ServerProtocolICPAPI
128
167
SQUIDCEXTERN int icpSetCacheKey(const cache_key * key);
 
168
 
 
169
/// \ingroup ServerProtocolICPAPI
129
170
SQUIDCEXTERN const cache_key *icpGetCacheKey(const char *url, int reqnum);
130
171
 
131
 
 
132
172
#endif /* SQUID_ICP_H */