1 /*
2  * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_ANYP_PORTCFG_H
10 #define SQUID_ANYP_PORTCFG_H
11 
12 #include "anyp/forward.h"
13 #include "anyp/ProtocolVersion.h"
14 #include "anyp/TrafficMode.h"
15 #include "comm/Connection.h"
16 #include "sbuf/SBuf.h"
17 #include "security/ServerOptions.h"
18 
19 namespace AnyP
20 {
21 
22 class PortCfg : public RefCountable
23 {
24 public:
25     PortCfg();
26     ~PortCfg();
27     AnyP::PortCfgPointer clone() const;
28 
29     PortCfgPointer next;
30 
31     Ip::Address s;
32     AnyP::ProtocolVersion transport; ///< transport protocol and version received by this port
33     char *name;                /* visible name */
34     char *defaultsite;         /* default web site */
35 
36     TrafficMode flags;  ///< flags indicating what type of traffic to expect via this port.
37 
38     bool allow_direct;       ///< Allow direct forwarding in accelerator mode
39     bool vhost;              ///< uses host header
40     bool actAsOrigin;        ///< update replies to conform with RFC 2616
41     bool ignore_cc;          ///< Ignore request Cache-Control directives
42 
43     bool connection_auth_disabled; ///< Don't support connection oriented auth
44 
45     bool ftp_track_dirs; ///< whether transactions should track FTP directories
46 
47     int vport;               ///< virtual port support. -1 if dynamic, >0 static
48     int disable_pmtu_discovery;
49 
50     struct {
51         unsigned int idle;
52         unsigned int interval;
53         unsigned int timeout;
54         bool enabled;
55     } tcp_keepalive;
56 
57     /**
58      * The listening socket details.
59      * If Comm::ConnIsOpen() we are actively listening for client requests.
60      * use listenConn->close() to stop.
61      */
62     Comm::ConnectionPointer listenConn;
63 
64     /// TLS configuration options for this listening port
65     Security::ServerOptions secure;
66 };
67 
68 } // namespace AnyP
69 
70 /// list of Squid http(s)_port configured
71 extern AnyP::PortCfgPointer HttpPortList;
72 
73 /// list of Squid ftp_port configured
74 extern AnyP::PortCfgPointer FtpPortList;
75 
76 #if !defined(MAXTCPLISTENPORTS)
77 // Max number of TCP listening ports
78 #define MAXTCPLISTENPORTS 128
79 #endif
80 
81 // TODO: kill this global array. Need to check performance of array vs list though.
82 extern int NHttpSockets;
83 extern int HttpSockets[MAXTCPLISTENPORTS];
84 
85 #endif /* SQUID_ANYP_PORTCFG_H */
86 
87