VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
glimits.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2017 Graeme Walker
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  enum { ssl_max_cache_entries = 10 } ; // libnss3 SSL_ConfigServerSessionIDCache()
55  #else
56  enum { path = 256 } ;
57  enum { log = 120 } ;
58  enum { file_buffer = 128 } ;
59  enum { file_slurp = 10000000 } ;
60  enum { pipe_buffer = 128 } ;
61  enum { get_pwnam_r_buffer = 200 } ;
62  enum { net_buffer = 512 } ;
63  enum { net_line_limit = 2000 } ;
64  enum { net_file_limit = 10000000 } ;
65  enum { net_hostname = 128 } ;
66  enum { net_listen_queue = 20 } ;
67  enum { net_certificate_cache_size = 2 } ;
68  enum { win32_subclass_limit = 2 } ;
69  enum { win32_classname_buffer = 128 } ;
70  enum { ssl_max_cache_entries = 0 } ;
71  #endif
72 
73 private:
74  limits() ; // not implemented
75 } ;
76 
77 #endif
A scoping structure for a set of buffer sizes.
Definition: glimits.h:35