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