2 Bacula® - The Network Backup Solution
4 Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version three of the GNU Affero General Public
10 License as published by the Free Software Foundation and included
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU Affero General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
30 * Written by Meno Abels, June MMIV
36 class IPADDR : public SMARTALLOC {
38 typedef enum { R_SINGLE, R_SINGLE_PORT, R_SINGLE_ADDR, R_MULTIPLE,
42 IPADDR(const IPADDR & src);
44 IPADDR() { /* block this construction */ }
47 struct sockaddr dontuse;
48 struct sockaddr_in dontuse4;
50 struct sockaddr_in6 dontuse6;
53 struct sockaddr *saddr;
54 struct sockaddr_in *saddr4;
56 struct sockaddr_in6 *saddr6;
59 void set_type(i_type o);
60 i_type get_type() const;
61 unsigned short get_port_net_order() const;
62 unsigned short get_port_host_order() const
64 return ntohs(get_port_net_order());
66 void set_port_net(unsigned short port);
67 int get_family() const;
68 struct sockaddr *get_sockaddr();
69 int get_sockaddr_len();
70 void copy_addr(IPADDR * src);
72 void set_addr4(struct in_addr *ip4);
74 void set_addr6(struct in6_addr *ip6);
76 const char *get_address(char *outputbuf, int outlen);
78 const char *build_address_str(char *buf, int blen);
84 extern void store_addresses(LEX * lc, RES_ITEM * item, int index, int pass);
85 extern void free_addresses(dlist * addrs);
86 extern void store_addresses_address(LEX * lc, RES_ITEM * item, int index, int pass);
87 extern void store_addresses_port(LEX * lc, RES_ITEM * item, int index, int pass);
88 extern void init_default_addresses(dlist ** addr, int port);
90 extern const char *get_first_address(dlist * addrs, char *outputbuf, int outlen);
91 extern int get_first_port_net_order(dlist * addrs);
92 extern int get_first_port_host_order(dlist * addrs);
94 extern const char *build_addresses_str(dlist *addrs, char *buf, int blen);
96 extern int sockaddr_get_port_net_order(const struct sockaddr *sa);
97 extern int sockaddr_get_port(const struct sockaddr *sa);
98 extern char *sockaddr_to_ascii(const struct sockaddr *sa, char *buf, int len);
100 #undef HAVE_OLD_SOCKOPT
102 #ifdef HAVE_OLD_SOCKOPT
103 extern int inet_aton(const char *cp, struct in_addr *inp);