E-MailRelay
glimits.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2018 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 
26 namespace 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 ///
35 class G::limits
36 {
37 public:
38 
39  #ifndef G_SMALL
40  enum { path = 33000 } ; // cf. MAX_PATH, PATH_MAX, MAXPATHLEN
41  enum { log = 1000 } ; // log line limit
42  enum { file_buffer = 102400 } ; // cf. BUFSIZ
43  enum { file_slurp = 100000000 } ; // read file into contiguous memory
44  enum { pipe_buffer = 4096 } ; // one-off read from a pipe
45  enum { get_pwnam_r_buffer = 1024 } ; // if no sysconf() value - more than line length in /etc/passwd
46  enum { net_buffer = 20000 } ; // best if bigger than the TLS maximum block size of 16k
47  enum { net_line_limit = 1000000 } ; // d.o.s. network read line limit
48  enum { net_file_limit = 200000000 } ; // d.o.s. network read file limit
49  enum { net_hostname = 1024 } ;
50  enum { net_listen_queue = 3 } ;
51  enum { net_certificate_cache_size = 50 } ;
52  enum { win32_subclass_limit = 80 } ;
53  enum { win32_classname_buffer = 256 } ;
54  #else
55  enum { path = 256 } ;
56  enum { log = 120 } ;
57  enum { file_buffer = 128 } ;
58  enum { file_slurp = 10000000 } ;
59  enum { pipe_buffer = 128 } ;
60  enum { get_pwnam_r_buffer = 200 } ;
61  enum { net_buffer = 512 } ;
62  enum { net_line_limit = 2000 } ;
63  enum { net_file_limit = 10000000 } ;
64  enum { net_hostname = 128 } ;
65  enum { net_listen_queue = 3 } ;
66  enum { net_certificate_cache_size = 2 } ;
67  enum { win32_subclass_limit = 2 } ;
68  enum { win32_classname_buffer = 128 } ;
69  #endif
70 
71 private:
72  limits() ; // not implemented
73 } ;
74 
75 #endif
A scoping structure for a set of buffer sizes.
Definition: glimits.h:35
Low-level classes.
Definition: garg.h:29