1 #ifndef _system_network_h
2 #define _system_network_h
4 Unix SMB/CIFS implementation.
6 networking system include wrappers
8 Copyright (C) Andrew Tridgell 2004
10 ** NOTE! The following LGPL license applies to the replace
11 ** library. This does NOT imply that all of Samba is released
14 This library is free software; you can redistribute it and/or
15 modify it under the terms of the GNU Lesser General Public
16 License as published by the Free Software Foundation; either
17 version 3 of the License, or (at your option) any later version.
19 This library is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 Lesser General Public License for more details.
24 You should have received a copy of the GNU Lesser General Public
25 License along with this library; if not, see <http://www.gnu.org/licenses/>.
29 #ifdef HAVE_SYS_SOCKET_H
30 #include <sys/socket.h>
33 #ifdef HAVE_UNIXSOCKET
37 #ifdef HAVE_NETINET_IN_H
38 #include <netinet/in.h>
40 #ifdef HAVE_ARPA_INET_H
41 #include <arpa/inet.h>
48 #ifdef HAVE_NETINET_TCP_H
49 #include <netinet/tcp.h>
53 * The next three defines are needed to access the IPTOS_* options
57 #ifdef HAVE_NETINET_IN_SYSTM_H
58 #include <netinet/in_systm.h>
61 #ifdef HAVE_NETINET_IN_IP_H
62 #include <netinet/in_ip.h>
65 #ifdef HAVE_NETINET_IP_H
66 #include <netinet/ip.h>
77 #ifdef HAVE_SYS_IOCTL_H
78 #include <sys/ioctl.h>
82 #ifndef SOCKET_WRAPPER_NOT_REPLACE
83 #define SOCKET_WRAPPER_REPLACE
85 #include "lib/socket_wrapper/socket_wrapper.h"
88 #ifdef REPLACE_INET_NTOA
89 /* define is in "replace.h" */
90 char *rep_inet_ntoa(struct in_addr ip);
93 #ifndef HAVE_INET_PTON
94 /* define is in "replace.h" */
95 int rep_inet_pton(int af, const char *src, void *dst);
98 #ifndef HAVE_INET_NTOP
99 /* define is in "replace.h" */
100 const char *rep_inet_ntop(int af, const void *src, char *dst, socklen_t size);
104 * glibc on linux doesn't seem to have MSG_WAITALL
105 * defined. I think the kernel has it though..
108 #define MSG_WAITALL 0
111 #ifndef INADDR_LOOPBACK
112 #define INADDR_LOOPBACK 0x7f000001
116 #define INADDR_NONE 0xffffffff
120 #define EAFNOSUPPORT EINVAL
123 #ifndef INET_ADDRSTRLEN
124 #define INET_ADDRSTRLEN 16
127 #ifndef INET6_ADDRSTRLEN
128 #define INET6_ADDRSTRLEN 46
131 #ifndef HAVE_SOCKLEN_T
132 typedef int socklen_t;
135 #ifndef HAVE_SA_FAMILY_T
136 typedef unsigned short int sa_family_t;
139 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
140 #ifdef HAVE_STRUCT_SOCKADDR_IN6
141 #define sockaddr_storage sockaddr_in6
142 #define ss_family sin6_family
144 #define sockaddr_storage sockaddr_in
145 #define ss_family sin_family
149 #ifndef HOST_NAME_MAX
150 #define HOST_NAME_MAX 256