1f08c3bdfSopenharmony_ci/* 2f08c3bdfSopenharmony_ci * Copyright (c) 2015 Fujitsu Ltd. 3f08c3bdfSopenharmony_ci * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz> 4f08c3bdfSopenharmony_ci * 5f08c3bdfSopenharmony_ci * This program is free software: you can redistribute it and/or modify 6f08c3bdfSopenharmony_ci * it under the terms of the GNU General Public License as published by 7f08c3bdfSopenharmony_ci * the Free Software Foundation, either version 2 of the License, or 8f08c3bdfSopenharmony_ci * (at your option) any later version. 9f08c3bdfSopenharmony_ci * 10f08c3bdfSopenharmony_ci * This program is distributed in the hope that it will be useful, 11f08c3bdfSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 12f08c3bdfSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13f08c3bdfSopenharmony_ci * GNU General Public License for more details. 14f08c3bdfSopenharmony_ci * 15f08c3bdfSopenharmony_ci * You should have received a copy of the GNU General Public License 16f08c3bdfSopenharmony_ci * along with this program. If not, see <http://www.gnu.org/licenses/>. 17f08c3bdfSopenharmony_ci */ 18f08c3bdfSopenharmony_ci 19f08c3bdfSopenharmony_ci#ifndef OLD_SAFE_NET_H__ 20f08c3bdfSopenharmony_ci#define OLD_SAFE_NET_H__ 21f08c3bdfSopenharmony_ci 22f08c3bdfSopenharmony_ci#include <sys/types.h> 23f08c3bdfSopenharmony_ci#include <sys/socket.h> 24f08c3bdfSopenharmony_ci#include <netinet/in.h> 25f08c3bdfSopenharmony_ci#include <arpa/inet.h> 26f08c3bdfSopenharmony_ci#include <sys/un.h> 27f08c3bdfSopenharmony_ci 28f08c3bdfSopenharmony_ci#include "safe_net_fn.h" 29f08c3bdfSopenharmony_ci 30f08c3bdfSopenharmony_ci#define SAFE_SOCKET(cleanup_fn, domain, type, protocol) \ 31f08c3bdfSopenharmony_ci safe_socket(__FILE__, __LINE__, (cleanup_fn), domain, type, protocol) 32f08c3bdfSopenharmony_ci 33f08c3bdfSopenharmony_ci#define SAFE_BIND(cleanup_fn, socket, address, address_len) \ 34f08c3bdfSopenharmony_ci safe_bind(__FILE__, __LINE__, (cleanup_fn), socket, address, \ 35f08c3bdfSopenharmony_ci address_len) 36f08c3bdfSopenharmony_ci 37f08c3bdfSopenharmony_ci#define SAFE_LISTEN(cleanup_fn, socket, backlog) \ 38f08c3bdfSopenharmony_ci safe_listen(__FILE__, __LINE__, (cleanup_fn), socket, backlog) 39f08c3bdfSopenharmony_ci 40f08c3bdfSopenharmony_ci#define SAFE_CONNECT(cleanup_fn, sockfd, addr, addrlen) \ 41f08c3bdfSopenharmony_ci safe_connect(__FILE__, __LINE__, (cleanup_fn), sockfd, addr, addrlen) 42f08c3bdfSopenharmony_ci 43f08c3bdfSopenharmony_ci#define SAFE_GETSOCKNAME(cleanup_fn, sockfd, addr, addrlen) \ 44f08c3bdfSopenharmony_ci safe_getsockname(__FILE__, __LINE__, (cleanup_fn), sockfd, addr, \ 45f08c3bdfSopenharmony_ci addrlen) 46f08c3bdfSopenharmony_ci 47f08c3bdfSopenharmony_ci#define TST_GET_UNUSED_PORT(cleanup_fn, family, type) \ 48f08c3bdfSopenharmony_ci tst_get_unused_port(__FILE__, __LINE__, (cleanup_fn), family, type) 49f08c3bdfSopenharmony_ci 50f08c3bdfSopenharmony_ci#endif /* OLD_SAFE_NET_H__ */ 51