]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/AccessLogEntry.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / AccessLogEntry.h
index d15604f2af36d4e77c28fb1c06db96478856db9a..e5cf61285754d39126e52023ef92a0926b9a6acf 100644 (file)
@@ -30,6 +30,8 @@
 #ifndef SQUID_HTTPACCESSLOGENTRY_H
 #define SQUID_HTTPACCESSLOGENTRY_H
 
+#include "anyp/PortCfg.h"
+#include "comm/Connection.h"
 #include "HttpVersion.h"
 #include "HttpRequestMethod.h"
 #include "HierarchyLogEntry.h"
 #if ICAP_CLIENT
 #include "adaptation/icap/Elements.h"
 #endif
+#include "RefCount.h"
+#if USE_SSL
+#include "ssl/gadgets.h"
+#endif
 
 /* forward decls */
 class HttpReply;
 class HttpRequest;
 
-class AccessLogEntry
+class AccessLogEntry: public RefCountable
 {
 
 public:
-    AccessLogEntry() : url(NULL) , reply(NULL), request(NULL),
+    typedef RefCount<AccessLogEntry> Pointer;
+
+    AccessLogEntry() : url(NULL), tcpClient(), reply(NULL), request(NULL),
             adapted_request(NULL) {}
+    ~AccessLogEntry();
+
+    /// Fetch the client IP log string into the given buffer.
+    /// Knows about several alternate locations of the IP
+    /// including indirect forwarded-for IP if configured to log that
+    void getLogClientIp(char *buf, size_t bufsz) const;
 
     const char *url;
 
+    /// TCP/IP level details about the client connection
+    Comm::ConnectionPointer tcpClient;
+    // TCP/IP level details about the server or peer connection
+    // are stored in hier.tcpServer
+
     /** \brief This subclass holds log info for HTTP protocol
      * \todo Inner class declarations should be moved outside
      * \todo details of HTTP held in the parent class need moving into here.
@@ -99,6 +118,18 @@ public:
         const char *opcode;
     } htcp;
 
+#if USE_SSL
+    /// logging information specific to the SSL protocol
+    class SslDetails
+    {
+    public:
+        SslDetails();
+
+        const char *user; ///< emailAddress from the SSL client certificate
+        int bumpMode; ///< whether and how the request was SslBumped
+    } ssl;
+#endif
+
     /** \brief This subclass holds log info for Squid internal stats
      * \todo Inner class declarations should be moved outside
      * \todo some details relevant to particular protocols need shuffling to other sub-classes
@@ -119,11 +150,12 @@ public:
                 msec(0),
                 rfc931 (NULL),
                 authuser (NULL),
-                extuser(NULL)
+                extuser(NULL),
 #if USE_SSL
-                ,ssluser(NULL)
+                ssluser(NULL),
 #endif
-        {;
+                port(NULL) {
+            ;
         }
 
         Ip::Address caddr;
@@ -141,7 +173,9 @@ public:
 #if USE_SSL
 
         const char *ssluser;
+        Ssl::X509_Pointer sslClientCert; ///< cert received from the client
 #endif
+        AnyP::PortCfg *port;
 
     } cache;
 
@@ -194,7 +228,6 @@ public:
     HttpRequest *request; //< virgin HTTP request
     HttpRequest *adapted_request; //< HTTP request after adaptation and redirection
 
-
 #if ICAP_CLIENT
     /** \brief This subclass holds log info for ICAP part of request
      *  \todo Inner class declarations should be moved outside
@@ -241,12 +274,11 @@ class ACLChecklist;
 class StoreEntry;
 
 /* Should be in 'AccessLog.h' as the driver */
-extern void accessLogLogTo(customlog* log, AccessLogEntryal, ACLChecklist* checklist = NULL);
-extern void accessLogLog(AccessLogEntry *, ACLChecklist * checklist);
+extern void accessLogLogTo(customlog* log, AccessLogEntry::Pointer &al, ACLChecklist* checklist = NULL);
+extern void accessLogLog(AccessLogEntry::Pointer &, ACLChecklist * checklist);
 extern void accessLogRotate(void);
 extern void accessLogClose(void);
 extern void accessLogInit(void);
-extern void accessLogFreeMemory(AccessLogEntry * aLogEntry);
 extern const char *accessLogTime(time_t);
 
 #endif /* SQUID_HTTPACCESSLOGENTRY_H */