blob: 3ba410ae30b64f359c3d0d65d6b8b6ba17eaded3 [file] [log] [blame]
Cyril Hrubisbbdb9f72016-03-16 15:53:57 +01001/*
2 * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
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 2 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#ifndef TST_SAFE_NET_H__
19#define TST_SAFE_NET_H__
20
21#include <sys/types.h>
22#include <sys/socket.h>
23#include <netinet/in.h>
24#include <arpa/inet.h>
25#include <sys/un.h>
26
27#include "safe_net_fn.h"
28
29#define SAFE_SOCKET(domain, type, protocol) \
30 safe_socket(__FILE__, __LINE__, NULL, domain, type, protocol)
31
32#define SAFE_BIND(socket, address, address_len) \
33 safe_bind(__FILE__, __LINE__, NULL, socket, address, \
34 address_len)
35
36#define SAFE_LISTEN(socket, backlog) \
37 safe_listen(__FILE__, __LINE__, NULL, socket, backlog)
38
39#define SAFE_CONNECT(sockfd, addr, addrlen) \
40 safe_connect(__FILE__, __LINE__, NULL, sockfd, addr, addrlen)
41
42#define SAFE_GETSOCKNAME(sockfd, addr, addrlen) \
43 safe_getsockname(__FILE__, __LINE__, NULL, sockfd, addr, \
44 addrlen)
45
Alexey Kodanev5065a9e2016-06-16 13:14:52 +030046#define SAFE_GETHOSTNAME(name, size) \
47 safe_gethostname(__FILE__, __LINE__, name, size)
48
Cyril Hrubisbbdb9f72016-03-16 15:53:57 +010049#endif /* TST_SAFE_NET_H__ */