1 /* Error code definitions
2  *
3  * Copyright (C) 2003-2004  Narcis Ilisei <inarcis2002@hotpop.com>
4  * Copyright (C) 2010-2021  Joachim Wiberg <troglobit@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, visit the Free Software Foundation
18  * website at http://www.gnu.org/licenses/gpl-2.0.html or write to the
19  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA  02110-1301, USA.
21  */
22 
23 #ifndef INADYN_ERROR_H_
24 #define INADYN_ERROR_H_
25 
26 #define RC_OK                           0
27 #define RC_ERROR                        1
28 #define RC_INVALID_POINTER              2
29 #define RC_OUT_OF_MEMORY                3
30 #define RC_BUFFER_OVERFLOW              4
31 #define RC_PIDFILE_EXISTS_ALREADY       5
32 
33 #define RC_TCP_SOCKET_CREATE_ERROR      10
34 #define RC_TCP_BAD_PARAMETER            11
35 #define RC_TCP_INVALID_REMOTE_ADDR      12
36 #define RC_TCP_CONNECT_FAILED           13
37 #define RC_TCP_SEND_ERROR               14
38 #define RC_TCP_RECV_ERROR               15
39 
40 #define RC_TCP_OBJECT_NOT_INITIALIZED   16
41 #define RC_HTTP_OBJECT_NOT_INITIALIZED  22
42 
43 #define RC_HTTPS_NO_TRUSTED_CA_STORE    31
44 #define RC_HTTPS_OUT_OF_MEMORY          32
45 #define RC_HTTPS_FAILED_CONNECT         33
46 #define RC_HTTPS_FAILED_GETTING_CERT    34
47 #define RC_HTTPS_SEND_ERROR             36
48 #define RC_HTTPS_RECV_ERROR             37
49 #define RC_HTTPS_SNI_ERROR              38
50 #define RC_HTTPS_INVALID_REQUEST        39
51 
52 #define RC_DDNS_INVALID_CHECKIP_RSP     42
53 #define RC_DDNS_INVALID_OPTION          45
54 #define RC_DDNS_RSP_NOHOST              47
55 #define RC_DDNS_RSP_NOTOK               48
56 #define RC_DDNS_RSP_RETRY_LATER         49
57 #define RC_DDNS_RSP_AUTH_FAIL           50
58 
59 #define RC_OS_INVALID_IP_ADDRESS        61
60 #define RC_OS_FORK_FAILURE              62
61 #define RC_OS_CHANGE_PERSONA_FAILURE    63
62 #define RC_OS_INVALID_UID               64
63 #define RC_OS_INVALID_GID               65
64 #define RC_OS_INSTALL_SIGHANDLER_FAILED 66
65 
66 #define RC_FILE_IO_ACCESS_ERROR         73
67 #define RC_FILE_IO_MISSING_FILE         74
68 
69 #define RC_RESTART                      255
70 
71 #define DO(fn)       { int rc = fn; if (rc) return rc; }
72 #define TRY(fn)      {     rc = fn; if (rc) break; }
73 #define ASSERT(cond) { if (!cond) return RC_INVALID_POINTER; }
74 
75 const char *error_str(int rc);
76 
77 #endif /* INADYN_ERROR_H_ */
78 
79 /**
80  * Local Variables:
81  *  indent-tabs-mode: t
82  *  c-file-style: "linux"
83  * End:
84  */
85