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>
52 #if !defined(HAVE_GETADDRINFO)
53 #include "getaddrinfo.h"
57 * The next three defines are needed to access the IPTOS_* options
61 #ifdef HAVE_NETINET_IN_SYSTM_H
62 #include <netinet/in_systm.h>
65 #ifdef HAVE_NETINET_IN_IP_H
66 #include <netinet/in_ip.h>
69 #ifdef HAVE_NETINET_IP_H
70 #include <netinet/ip.h>
81 #ifdef HAVE_SYS_IOCTL_H
82 #include <sys/ioctl.h>
86 #ifndef SOCKET_WRAPPER_NOT_REPLACE
87 #define SOCKET_WRAPPER_REPLACE
89 #include "lib/socket_wrapper/socket_wrapper.h"
92 #ifdef REPLACE_INET_NTOA
93 /* define is in "replace.h" */
94 char *rep_inet_ntoa(struct in_addr ip);
97 #ifndef HAVE_INET_PTON
98 /* define is in "replace.h" */
99 int rep_inet_pton(int af, const char *src, void *dst);
102 #ifndef HAVE_INET_NTOP
103 /* define is in "replace.h" */
104 const char *rep_inet_ntop(int af, const void *src, char *dst, socklen_t size);
108 * glibc on linux doesn't seem to have MSG_WAITALL
109 * defined. I think the kernel has it though..
112 #define MSG_WAITALL 0
115 #ifndef INADDR_LOOPBACK
116 #define INADDR_LOOPBACK 0x7f000001
120 #define INADDR_NONE 0xffffffff
124 #define EAFNOSUPPORT EINVAL
127 #ifndef INET_ADDRSTRLEN
128 #define INET_ADDRSTRLEN 16
131 #ifndef INET6_ADDRSTRLEN
132 #define INET6_ADDRSTRLEN 46
135 #ifndef HAVE_SOCKLEN_T
136 typedef int socklen_t;
139 #ifndef HAVE_SA_FAMILY_T
140 typedef unsigned short int sa_family_t;
143 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
144 #ifdef HAVE_STRUCT_SOCKADDR_IN6
145 #define sockaddr_storage sockaddr_in6
146 #define ss_family sin6_family
148 #define sockaddr_storage sockaddr_in
149 #define ss_family sin_family
153 #ifndef HOST_NAME_MAX
154 #define HOST_NAME_MAX 256