1 /*
2 ** Zabbix
3 ** Copyright (C) 2001-2021 Zabbix SIA
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 **/
19 
20 #ifndef ZABBIX_SYSINFO_COMMON_NET_H
21 #define ZABBIX_SYSINFO_COMMON_NET_H
22 
23 #include "sysinfo.h"
24 
25 #if defined(HAVE_RES_QUERY) || defined(_WINDOWS)
26 
27 #	if !defined(C_IN) && !defined(_WINDOWS)
28 #		define C_IN	ns_c_in
29 #	endif
30 
31 /* define DNS record types to use common names on all systems, see RFC1035 standard for the types */
32 #	ifndef T_ANY
33 #		define T_ANY	255
34 #	endif
35 #	ifndef T_A
36 #		define T_A	1
37 #	endif
38 #	ifndef T_NS
39 #		define T_NS	2
40 #	endif
41 #	ifndef T_MD
42 #		define T_MD	3
43 #	endif
44 #	ifndef T_MF
45 #		define T_MF	4
46 #	endif
47 #	ifndef T_CNAME
48 #		define T_CNAME	5
49 #	endif
50 #	ifndef T_SOA
51 #		define T_SOA	6
52 #	endif
53 #	ifndef T_MB
54 #		define T_MB	7
55 #	endif
56 #	ifndef T_MG
57 #		define T_MG	8
58 #	endif
59 #	ifndef T_MR
60 #		define T_MR	9
61 #	endif
62 #	ifndef T_NULL
63 #		define T_NULL	10
64 #	endif
65 #	ifndef T_WKS
66 #		define T_WKS	11
67 #	endif
68 #	ifndef T_PTR
69 #		define T_PTR	12
70 #	endif
71 #	ifndef T_HINFO
72 #		define T_HINFO	13
73 #	endif
74 #	ifndef T_MINFO
75 #		define T_MINFO	14
76 #	endif
77 #	ifndef T_MX
78 #		define T_MX	15
79 #	endif
80 #	ifndef T_TXT
81 #		define T_TXT	16
82 #	endif
83 #	ifndef T_AAAA
84 #		define T_AAAA	28
85 #	endif
86 #	ifndef T_SRV
87 #		define T_SRV	33
88 #	endif
89 
90 #endif /* defined(HAVE_RES_QUERY) || defined(_WINDOWS) */
91 
92 extern char	*CONFIG_SOURCE_IP;
93 
94 #define ZBX_TCP_EXPECT_FAIL	-1
95 #define ZBX_TCP_EXPECT_OK	0
96 #define ZBX_TCP_EXPECT_IGNORE	1
97 
98 int	tcp_expect(const char *host, unsigned short port, int timeout, const char *request,
99 		int(*validate_func)(const char *), const char *sendtoclose, int *value_int);
100 
101 int	NET_DNS(AGENT_REQUEST *request, AGENT_RESULT *result);
102 int	NET_DNS_RECORD(AGENT_REQUEST *request, AGENT_RESULT *result);
103 int	NET_TCP_PORT(AGENT_REQUEST *request, AGENT_RESULT *result);
104 
105 #endif /* ZABBIX_SYSINFO_COMMON_NET_H */
106