Update CHANGES for serverSlots1.
[polipo.git] / server.h
blobc2cbb40932adbbce482903975c44dcb042038909
1 /*
2 Copyright (c) 2003-2006 by Juliusz Chroboczek
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
23 extern int serverExpireTime, dontCacheRedirects;
25 typedef struct _HTTPServer {
26 char *name;
27 int port;
28 int addrindex;
29 int isProxy;
30 int version;
31 int persistent;
32 int pipeline;
33 int lies;
34 int rtt;
35 int rate;
36 time_t time;
37 int numslots;
38 int maxslots;
39 HTTPConnectionPtr *connection;
40 FdEventHandlerPtr *idleHandler;
41 HTTPRequestPtr request, request_last;
42 struct _HTTPServer *next;
43 } HTTPServerRec, *HTTPServerPtr;
45 extern AtomPtr parentHost;
46 extern int parentPort;
48 void preinitServer(void);
49 void initServer(void);
51 void httpServerAbortHandler(ObjectPtr object);
52 int httpMakeServerRequest(char *name, int port, ObjectPtr object,
53 int method, int from, int to,
54 HTTPRequestPtr requestor);
55 int httpServerQueueRequest(HTTPServerPtr server, HTTPRequestPtr request);
56 int httpServerTrigger(HTTPServerPtr server);
57 int httpServerSideRequest(HTTPServerPtr server);
58 int httpServerDoSide(HTTPConnectionPtr connection);
59 int httpServerSideHandler(int status,
60 FdEventHandlerPtr event,
61 StreamRequestPtr srequest);
62 int httpServerSideHandler2(int status,
63 FdEventHandlerPtr event,
64 StreamRequestPtr srequest);
65 int httpServerConnectionDnsHandler(int status,
66 GethostbynameRequestPtr request);
67 int httpServerConnectionHandler(int status,
68 FdEventHandlerPtr event,
69 ConnectRequestPtr request);
70 int httpServerSocksHandler(int status, SocksRequestPtr request);
71 int httpServerConnectionHandlerCommon(int status,
72 HTTPConnectionPtr connection);
73 void httpServerFinish(HTTPConnectionPtr connection, int s, int offset);
75 void httpServerReply(HTTPConnectionPtr connection, int immediate);
76 void httpServerAbort(HTTPConnectionPtr connection, int, int, struct _Atom *);
77 void httpServerAbortRequest(HTTPRequestPtr request, int, int, struct _Atom *);
78 void httpServerClientReset(HTTPRequestPtr request);
79 void httpServerUnpipeline(HTTPRequestPtr request);
80 int
81 httpServerSendRequest(HTTPConnectionPtr connection);
82 int
83 httpServerHandler(int status,
84 FdEventHandlerPtr event,
85 StreamRequestPtr request);
86 int
87 httpServerReplyHandler(int status,
88 FdEventHandlerPtr event,
89 StreamRequestPtr request);
90 int
91 httpServerIndirectHandler(int status,
92 FdEventHandlerPtr event,
93 StreamRequestPtr request);
94 int
95 httpServerDirectHandler(int status,
96 FdEventHandlerPtr event,
97 StreamRequestPtr request);
98 int
99 httpServerDirectHandler2(int status,
100 FdEventHandlerPtr event,
101 StreamRequestPtr request);
102 int httpServerRequest(ObjectPtr object, int method, int from, int to,
103 HTTPRequestPtr, void*);
104 int httpServerHandlerHeaders(int eof,
105 FdEventHandlerPtr event,
106 StreamRequestPtr request,
107 HTTPConnectionPtr connection);
108 int httpServerReadData(HTTPConnectionPtr, int);
109 int connectionAddData(HTTPConnectionPtr connection, int skip);
110 int
111 httpWriteRequest(HTTPConnectionPtr connection, HTTPRequestPtr request, int);
113 void listServers(FILE*);