2
Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; version 2 of the
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22
#ifndef _NETWORK_ADDRESS_H_
23
#define _NETWORK_ADDRESS_H_
32
#ifdef HAVE_NETINET_IN_H
33
#include <netinet/in.h> /** struct sockaddr_in */
35
#include <netinet/tcp.h>
38
#include <sys/un.h> /** struct sockaddr_un */
40
#include <sys/socket.h> /** struct sockaddr (freebsd and hp/ux need it) */
46
#include "network-exports.h"
49
/* see http://curl.haxx.se/mail/lib-2009-04/0287.html */
50
typedef int network_socklen_t;
52
typedef socklen_t network_socklen_t;
57
struct sockaddr_in ipv4;
58
struct sockaddr_in6 ipv6;
60
struct sockaddr_un un;
62
struct sockaddr common;
66
network_socklen_t len;
67
gboolean can_unlink_socket; /* set TRUE *only* after successful bind */
70
NETWORK_API network_address *network_address_new(void);
71
NETWORK_API void network_address_free(network_address *);
72
NETWORK_API void network_address_reset(network_address *addr);
73
NETWORK_API network_address *network_address_copy(network_address *dst, network_address *src);
74
NETWORK_API gint network_address_set_address(network_address *addr, const gchar *address);
75
NETWORK_API gint network_address_refresh_name(network_address *addr);
76
NETWORK_API gint network_address_is_local(network_address *dst_addr, network_address *src_addr);