E-MailRelay
glimits.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2021 Graeme Walker <graeme_walker@users.sourceforge.net>
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16// ===
17///
18/// \file glimits.h
19///
20
21#ifndef G_LIMITS_H
22#define G_LIMITS_H
23
24#include "gdef.h"
25
26namespace G
27{
28 class limits ;
29}
30
31//| \class G::limits
32/// A scoping structure for a set of buffer sizes. Intended to be used to
33/// reduce memory requirements in embedded environments.
34///
36{
37public:
38
39 #ifndef G_SMALL
40 static constexpr int log = 1000 ; // log line limit
41 static constexpr int path_buffer = 1024 ; // cf. PATH_MAX
42 static constexpr int file_buffer = 102400 ; // cf. BUFSIZ
43 static constexpr int file_slurp = 100000000 ; // read file into contiguous memory
44 static constexpr int pipe_buffer = 4096 ; // one-off read from a pipe
45 static constexpr int net_buffer = 20000 ; // best if bigger than the TLS maximum block size of 16k
46 static constexpr int net_file_limit = 200000000 ; // d.o.s. network read file limit
47 static constexpr int net_listen_queue = 31 ; // listen(2) backlog parameter (cf. apache 511)
48 #else
49 static constexpr int log = 120 ;
50 static constexpr int path_buffer = 64 ;
51 static constexpr int file_buffer = 128 ;
52 static constexpr int file_slurp = 10000000 ;
53 static constexpr int pipe_buffer = 128 ;
54 static constexpr int net_buffer = 512 ;
55 static constexpr int net_file_limit = 10000000 ;
56 static constexpr int net_listen_queue = 3 ;
57 #endif
58
59public:
60 limits() = delete ;
61} ;
62
63#endif
A scoping structure for a set of buffer sizes.
Definition: glimits.h:36
Low-level classes.
Definition: galign.h:28