NetSurf
inet.h
Go to the documentation of this file.
1/*
2 * Copyright 2016 Vincent Sanders <vince@netsurf-browser.org>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf 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/**
20 * \file
21 * internet structures and defines
22 *
23 * This allows the obtaining of standard bsd sockets and associated
24 * functions in a uniform way despite any oddities in headers and
25 * supported API between OS.
26 *
27 * \note This functionality was previously provided as a side effect of the
28 * utils config header include.
29 */
30
31#ifndef _NETSURF_UTILS_INET_H_
32#define _NETSURF_UTILS_INET_H_
33
34#include "utils/config.h"
35
36#ifdef HAVE_POSIX_INET_HEADERS
37
38#include <sys/socket.h>
39#include <netinet/in.h>
40#include <arpa/inet.h>
41#include <sys/select.h>
42
43#define ns_close_socket close
44
45#ifdef WITH_AMISSL
46/* AmiSSL needs everything to be using bsdsocket directly to avoid conflicts */
47#include <proto/bsdsocket.h>
48#undef ns_close_socket
49#define ns_close_socket CloseSocket
50#endif
51
52#else
53
54#include <winsock2.h>
55#include <ws2tcpip.h>
56
57#ifndef EAFNOSUPPORT
58#define EAFNOSUPPORT WSAEAFNOSUPPORT
59#endif
60
61#define ns_close_socket closesocket
62
63#endif
64
65
66#ifndef HAVE_INETATON
67int inet_aton(const char *cp, struct in_addr *inp);
68#endif
69
70#ifndef HAVE_INETPTON
71int inet_pton(int af, const char *src, void *dst);
72#endif
73
74#endif
int inet_aton(const char *cp, struct in_addr *inp)
Definition: utils.c:489
int inet_pton(int af, const char *src, void *dst)
Definition: utils.c:512