-
Notifications
You must be signed in to change notification settings - Fork 2
/
LibSettings.h
137 lines (88 loc) · 4.96 KB
/
LibSettings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
Copyright (c) 2015 Colum Paget <[email protected]>
* SPDX-License-Identifier: GPL-3.0
*/
#ifndef LIBUSEFUL_SETTINGS
#define LIBUSEFUL_SETTINGS
#include "Vars.h"
/*
These functions provide an interface for setting variables that are used by libUseful itself
or that are default values used by functions.
Possible variables are:
LibUseful:Version This is set automatically when any of these functions are first called
LibUseful:BuildTime This is set automatically when any of these functions are first called.
Error:Debug If this is set to 'yes', 'y' or 'true' (case insensitive) then RaiseError
will print out debug statements.
Error:Silent If this is set to 'yes', 'y' or 'true' (case insensitive) then RaiseError
won't print anything to stderr
Error:Syslog If this is set to 'yes', 'y' or 'true' (case insensitive) then RaiseError
will send messages to the system logger via syslog
Error:IgnoreIP If this is set to 'yes', 'y' or 'true' (case insensitive) then errors will
not be raised when network connections fail. This can be overriden on a
per-connection basis by passing the 'E' flag to STREAMOpen or the
CONNECT_ERROR flag to lower level functions
SwitchUserAllowFail The SwitchUser function normally kills our process if it fails. Setting
this to 'yes', 'y' or 'true' (case insensitive) will allow the program to
continue even if switching UID fails
SwitchGroupAllowFail The SwitchGroup function normally kills our process if it fails. Setting
this to 'yes', 'y' or 'true' will allow the program to continue even if
switching GID fails
HTTP:Debug set this to 'true' or 'y' (case insensitive) to get debugging printed to
stderr for all HTTP connections
HTTP:NoCookies set this to 'true' or 'y' (case insensitive) to disable cookie suppport
on all HTTP connections
HTTP:NoCompression set this to 'true' or 'y' (case insensitive) to disable compression
on all HTTP connections
HTTP:NoRedirect set this to 'true' or 'y' (case insensitive) to disable internal handling
of redirects on all HTTP connections
HTTP:NoCache set this to 'true' or 'y' (case insensitive) to prevent servers sending
cached copies of pages all HTTP connections
HTTP:UserAgent set default UserAgent value to be used by HTTP connections
SSL:Library openssl library that libUseful is linked against. This is set on first use
of ssl connections or call to 'SSLAvailable' and has the format:
name:version:build date:cflags
currently openssl is the only supported library
SSL:Level minimum SSL/TLS version to use on SSL connections. possible values are
ssl ssl version 3
tls tls version 1
tls1.1 tls version 1.1
tls1.2 tls version 1.2
currently 'tls' is the default
SSL:PermittedCiphers openssl-format list of permitted ciphers (cipher names separated by :)
SSL:CertFile set default certificate file to be offered by server-side ssl/tls connections
SSL:KeyFile set default key file to be offered by server-side ssl/tls connections
SSL:VerifyCertDir set directory full of C.A. certificates to be used in certificate verification
SSL:VerifyCertFile set path to file containing a concatanated list of C.A. certificates to be
used in certificate verification
Net:Timeout set default timeout for all network connections
TCP:keep_alives use tcp keepalives for all network connections
Unicode:NamesFile path to file that maps names->unicode code points
*/
#define LU_ATEXIT_REGISTERED 1
#define LU_CONTAINER 2
#define LU_STRLEN_NOCACHE 4
#define LU_MLOCKALL 8
#define LU_RESIST_PTRACE 16
extern int LibUsefulFlags;
#ifdef __cplusplus
extern "C" {
#endif
//Get List of values
ListNode *LibUsefulValuesGetHead();
//set get values
void LibUsefulSetValue(const char *Name, const char *Value);
const char *LibUsefulGetValue(const char *Name);
//get a value as a boolean. This treats a value set to 'yes' 'y' or 'true' as true regardless
//of case (so uppercase or mixed-case works too). Any other value is false
int LibUsefulGetBool(const char *Name);
int LibUsefulGetInteger(const char *Name);
//returns TRUE if libUseful Debug is active, FALSE otehrwise
int LibUsefulDebugActive();
//this function gets called at exit to do certain cleaning up. It's no concern of the user.
//nothing to see here, move along
void LibUsefulAtExit();
void LibUsefulSetupAtExit();
#ifdef __cplusplus
};
#endif
#endif