1/*	$Id: server6_conf.h,v 1.1.1.1 2006/12/04 00:45:34 Exp $	*/
2
3/*
4 * Copyright (C) International Business Machines  Corp., 2003
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the project nor the names of its contributors
16 *    may be used to endorse or promote products derived from this software
17 *    without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32/* Author: Shirley Ma, xma@us.ibm.com */
33
34#ifndef __SERVER6_CONF_H_DEFINED
35#define __SERVER6_CONF_H_DEFINED
36
37#define DEFAULT_PREFERRED_LIFE_TIME 360000
38#define DEFAULT_VALID_LIFE_TIME 720000
39
40
41struct rootgroup *globalgroup;
42
43/* provide common paramters within scopes */
44struct scope {
45	int32_t prefer_life_time;
46	int32_t valid_life_time;
47	int32_t renew_time;
48	int32_t rebind_time;
49	int8_t server_pref;
50	u_int8_t send_flags;
51	u_int8_t allow_flags;
52	struct dns_list dnslist;
53	struct dhcp6_list siplist;
54	struct dhcp6_list ntplist;
55};
56
57struct scopelist {
58	struct scopelist *prev;
59	struct scopelist *next;
60	struct scope *scope;
61};
62
63struct rootgroup {
64	struct scope scope;
65	struct scope *group;
66	struct interface *iflist;
67};
68
69struct v6addr {
70	struct in6_addr addr;
71	u_int8_t plen;
72};
73/* interface network declaration */
74/* interface declaration is used to inform DHCPv6 server that the links */
75/* and pool declared within it are connected to the same network segment */
76struct interface {
77	struct interface *next;
78	char name[IFNAMSIZ];
79	struct hardware hw_address;
80	struct in6_addr primary_v6addr;
81	struct in6_addr linklocal;
82	struct link_decl *linklist;
83	struct host_decl *hostlist;
84	struct scope ifscope;
85	struct scope *group;
86};
87
88/* link declaration */
89/* link declaration is used to provide the DHCPv6 server with enough   */
90/* information to determin whether a particular IPv6 addresses is on the */
91/* link */
92struct link_decl {
93	struct link_decl *next;
94	char name[IFNAMSIZ];
95	struct v6addrlist *relaylist;
96	struct v6addrseg *seglist;
97	struct v6prefix *prefixlist;
98	struct pool_decl *poollist;
99	struct interface *network;
100	struct scope linkscope;
101	struct scope *group;
102};
103
104
105struct v6addrseg {
106	struct v6addrseg *next;
107	struct v6addrseg *prev;
108	struct link_decl *link;
109	struct pool_decl *pool;
110	struct in6_addr min;
111	struct in6_addr max;
112	struct in6_addr free;
113	struct v6addr prefix;
114	struct lease *active;
115	struct lease *expired;
116	struct lease *abandoned;
117	struct scope parainfo;
118};
119
120struct v6prefix {
121	struct v6prefix *next;
122	struct v6prefix *prev;
123	struct link_decl *link;
124	struct pool_decl *pool;
125	struct v6addr prefix;
126	struct scope parainfo;
127};
128
129/* The pool declaration is used to declare an address pool from which IPv6 */
130/* address can be allocated, with its own permit to control client access  */
131/* and its own scopt in which you can declare pool-specific parameter*/
132struct pool_decl {
133	struct pool_decl *next;
134	struct interface *network;
135	struct link_decl *link;
136	struct scope poolscope;
137	struct scope *group;
138};
139
140struct v6addrlist {
141	struct v6addrlist *next;
142	struct v6addr v6addr;
143};
144
145/* host declaration */
146/* host declaration provides information about a particular DHCPv6 client */
147struct host_decl {
148	struct host_decl *next;
149	char name[IFNAMSIZ];
150	struct duid cid;
151	struct dhcp6_iaid_info iaidinfo;
152	struct dhcp6_list addrlist;
153	struct dhcp6_list prefixlist;
154	struct interface *network;
155	struct scope hostscope;
156	struct scope *group;
157};
158
159int is_anycast __P((struct in6_addr *, int));
160extern void printf_in6addr __P((struct in6_addr *));
161void post_config(struct rootgroup *);
162int sfparse __P((char *));
163int ipv6addrcmp __P((struct in6_addr *, struct in6_addr *));
164struct v6addr *getprefix __P((struct in6_addr *, int));
165struct in6_addr *inc_ipv6addr __P((struct in6_addr *));
166struct scopelist *push_double_list __P((struct scopelist *, struct scope *));
167struct scopelist *pop_double_list __P((struct scopelist *));
168int get_primary_ipv6addr __P((const char *device));
169
170#endif
171