]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Build IPIntercept object to manage IP interception and transparent operations.
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 8 Apr 2008 06:28:03 +0000 (18:28 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 8 Apr 2008 06:28:03 +0000 (18:28 +1200)
src/IPInterception.cc
src/IPInterception.h

index 5feb509169cbbc6e559f71f1593a77cfae1fd6d7..a027089799700515722759612986d0c584e2f6ef 100644 (file)
 #include <linux/netfilter_ipv4.h>
 #endif
 
+
+// single global instance for access by other components.
+IPIntercept IPInterceptor;
+
+
+// TODO split this one call into one per transparency method
+//     with specific switching at run-time ??
+
 int
-clientNatLookup(int fd, const IPAddress &me, const IPAddress &peer, IPAddress &dst)
+IPIntercept::NatLookup(int fd, const IPAddress &me, const IPAddress &peer, IPAddress &dst)
 {
-
 #if IPF_TRANSPARENT  /* --enable-ipf-transparent */
-
     dst = me;
     if( !me.IsIPv4() ) return -1;
     if( !peer.IsIPv4() ) return -1;
index 0e349b81fa7106b24b790556d016015ef87226c0..1f9d0aafb22a977dabfb314489685225ce74c846 100644 (file)
 #ifndef SQUID_IPINTERCEPTION_H
 #define SQUID_IPINTERCEPTION_H
 
-#include "IPAddress.h"
+class IPAddress;
 
-#if LINUX_TPROXY4 && !defined(IP_TRANSPARENT)
+/**
+ \defgroup IPInterceptAPI IP Interception and Transparent Proxy API
+ \ingroup SquidComponent
+ \par
+ * There is no formal state-machine for transparency and interception
+ * instead there is this neutral API which other connection state machines
+ * and the comm layer use to co-ordinate their own state for transparency.
+ */
+class IPIntercept
+{
+public:
+    int NatLookup(int fd, const IPAddress &me, const IPAddress &peer, IPAddress &dst);
+}
+
+#if !defined(IP_TRANSPARENT)
+/// \ingroup IPInterceptAPI
 #define IP_TRANSPARENT 19
 #endif
 
-SQUIDCEXTERN int clientNatLookup(int fd, const IPAddress &me, const IPAddress &peer, IPAddress &dst);
+/**
+ \ingroup IPInterceptAPI
+ * Globally available instance of the IP Interception manager.
+ */
+extern IPIntercept IPInterceptor;
 
 #endif /* SQUID_IPINTERCEPTION_H */