]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/ICP.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / ICP.h
index 0973f4784b34f6104597f6655b709d479ec2266e..a6a79af3e48223f62d217ba423a48532204689df 100644 (file)
--- a/src/ICP.h
+++ b/src/ICP.h
@@ -1,5 +1,5 @@
 /*
- * $Id: ICP.h,v 1.11 2008/02/26 21:49:34 amosjeffries Exp $
+ * $Id$
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 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, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
  \ingroup ServerProtocol
  */
 
+#include "comm/forward.h"
+#include "icp_opcode.h"
+#include "ip/Address.h"
 #include "StoreClient.h"
 
+class HttpRequest;
+
 /**
  \ingroup ServerProtocolICPAPI
  *
@@ -47,8 +52,7 @@
  * DO NOT add more move fields on pain of breakage.
  * DO NOT add virtual methods.
  */
-struct _icp_common_t
-{
+struct _icp_common_t {
     /** opcode */
     unsigned char opcode;
     /** version number */
@@ -56,20 +60,20 @@ struct _icp_common_t
     /** total length (bytes) */
     unsigned short length;
     /** req number (req'd for UDP) */
-    u_int32_t reqnum;
-    u_int32_t flags;
-    u_int32_t pad;
+    uint32_t reqnum;
+    uint32_t flags;
+    uint32_t pad;
     /** sender host id */
-    u_int32_t shostid;
+    uint32_t shostid;
 
 /// \todo I don't believe this header is included in non-c++ code anywhere
-///            the struct should become a public POD class and kill these #ifdef.
+///            the struct should become a public POD class and kill these ifdef.
 #ifdef __cplusplus
 
     _icp_common_t();
     _icp_common_t(char *buf, unsigned int len);
 
-    void handleReply(char *buf, IPAddress &from);
+    void handleReply(char *buf, Ip::Address &from);
     static _icp_common_t *createMessage(icp_opcode opcode, int flags, const char *url, int reqnum, int pad);
     icp_opcode getOpCode() const;
 #endif
@@ -85,7 +89,6 @@ inline icp_opcode & operator++ (icp_opcode & aCode)
     return aCode;
 }
 
-
 /**
  \ingroup ServerProtocolICPAPI
  \todo mempool this
@@ -100,16 +103,18 @@ public:
     HttpRequest *request;
     int fd;
 
-    IPAddress from;
+    Ip::Address from;
     char *url;
 };
 
 #endif
 
 /// \ingroup ServerProtocolICPAPI
-struct icpUdpData
-{
-    IPAddress address;
+struct icpUdpData {
+
+    /// IP address for the remote end. Because we reply to packets from unknown non-peers.
+    Ip::Address address;
+
     void *msg;
     size_t len;
     icpUdpData *next;
@@ -123,26 +128,30 @@ struct icpUdpData
     struct timeval queue_time;
 };
 
+extern Comm::ConnectionPointer icpIncomingConn;
+extern Comm::ConnectionPointer icpOutgoingConn;
+extern Ip::Address theIcpPublicHostID;
+
 /// \ingroup ServerProtocolICPAPI
-HttpRequest* icpGetRequest(char *url, int reqnum, int fd, IPAddress &from);
+extern HttpRequest* icpGetRequest(char *url, int reqnum, int fd, Ip::Address &from);
 
 /// \ingroup ServerProtocolICPAPI
-int icpAccessAllowed(IPAddress &from, HttpRequest * icp_request);
+extern bool icpAccessAllowed(Ip::Address &from, HttpRequest * icp_request);
 
 /// \ingroup ServerProtocolICPAPI
-SQUIDCEXTERN void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const IPAddress &from);
+SQUIDCEXTERN void icpCreateAndSend(icp_opcode, int flags, char const *url, int reqnum, int pad, int fd, const Ip::Address &from);
 
 /// \ingroup ServerProtocolICPAPI
 extern icp_opcode icpGetCommonOpcode();
 
 /// \ingroup ServerProtocolICPAPI
-SQUIDCEXTERN int icpUdpSend(int, const IPAddress &, icp_common_t *, log_type, int);
+SQUIDCEXTERN int icpUdpSend(int, const Ip::Address &, icp_common_t *, log_type, int);
 
 /// \ingroup ServerProtocolICPAPI
 SQUIDCEXTERN log_type icpLogFromICPCode(icp_opcode opcode);
 
 /// \ingroup ServerProtocolICPAPI
-void icpDenyAccess(IPAddress &from, char *url, int reqnum, int fd);
+void icpDenyAccess(Ip::Address &from, char *url, int reqnum, int fd);
 
 /// \ingroup ServerProtocolICPAPI
 SQUIDCEXTERN PF icpHandleUdp;
@@ -151,19 +160,19 @@ SQUIDCEXTERN PF icpHandleUdp;
 SQUIDCEXTERN PF icpUdpSendQueue;
 
 /// \ingroup ServerProtocolICPAPI
-SQUIDCEXTERN void icpHandleIcpV3(int, IPAddress &, char *, int);
+SQUIDCEXTERN void icpHandleIcpV3(int, Ip::Address &, char *, int);
 
 /// \ingroup ServerProtocolICPAPI
 SQUIDCEXTERN int icpCheckUdpHit(StoreEntry *, HttpRequest * request);
 
 /// \ingroup ServerProtocolICPAPI
-SQUIDCEXTERN void icpConnectionsOpen(void);
+SQUIDCEXTERN void icpOpenPorts(void);
 
 /// \ingroup ServerProtocolICPAPI
 SQUIDCEXTERN void icpConnectionShutdown(void);
 
 /// \ingroup ServerProtocolICPAPI
-SQUIDCEXTERN void icpConnectionClose(void);
+SQUIDCEXTERN void icpClosePorts(void);
 
 /// \ingroup ServerProtocolICPAPI
 SQUIDCEXTERN int icpSetCacheKey(const cache_key * key);