1/*
2 * Copyright (c) 2015 Fujitsu Ltd.
3 * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
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, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef OLD_SAFE_NET_H__
20#define OLD_SAFE_NET_H__
21
22#include <sys/types.h>
23#include <sys/socket.h>
24#include <netinet/in.h>
25#include <arpa/inet.h>
26#include <sys/un.h>
27
28#include "safe_net_fn.h"
29
30#define SAFE_SOCKET(cleanup_fn, domain, type, protocol) \
31	safe_socket(__FILE__, __LINE__, (cleanup_fn), domain, type, protocol)
32
33#define SAFE_BIND(cleanup_fn, socket, address, address_len) \
34	safe_bind(__FILE__, __LINE__, (cleanup_fn), socket, address, \
35		  address_len)
36
37#define SAFE_LISTEN(cleanup_fn, socket, backlog) \
38	safe_listen(__FILE__, __LINE__, (cleanup_fn), socket, backlog)
39
40#define SAFE_CONNECT(cleanup_fn, sockfd, addr, addrlen) \
41	safe_connect(__FILE__, __LINE__, (cleanup_fn), sockfd, addr, addrlen)
42
43#define SAFE_GETSOCKNAME(cleanup_fn, sockfd, addr, addrlen) \
44	safe_getsockname(__FILE__, __LINE__, (cleanup_fn), sockfd, addr, \
45			 addrlen)
46
47#endif /* OLD_SAFE_NET_H__ */
48