3 Tables of information only used by client... */
6 * Copyright (c) 2017 by Internet Systems Consortium, Inc. ("ISC")
8 * This Source Code Form is subject to the terms of the Mozilla Public
9 * License, v. 2.0. If a copy of the MPL was not distributed with this
10 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
18 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 * Internet Systems Consortium, Inc.
22 * Newmarket, NH 03857 USA
24 * https://www.isc.org/
30 struct universe client_universe
;
31 static struct option client_options
[] = {
32 /* @todo dummy-client-parm should be removed with the first real param */
33 { "dummy-client-parm", "T", &client_universe
, 1, 1 },
34 { NULL
, NULL
, NULL
, 0, 0 }
37 #define CLIENT_HASH_SIZE (2*(sizeof(client_options) / sizeof(struct option)))
39 void initialize_client_option_spaces()
43 /* Set up the client option universe... */
44 client_universe
.name
= "client";
45 client_universe
.concat_duplicates
= 0;
46 client_universe
.lookup_func
= lookup_hashed_option
;
47 client_universe
.option_state_dereference
=
48 hashed_option_state_dereference
;
49 client_universe
.save_func
= save_hashed_option
;
50 client_universe
.delete_func
= delete_hashed_option
;
51 client_universe
.encapsulate
= hashed_option_space_encapsulate
;
52 client_universe
.foreach
= hashed_option_space_foreach
;
53 client_universe
.length_size
= 1; /* Never used ... */
54 client_universe
.tag_size
= 4;
55 client_universe
.store_tag
= putUChar
;
56 client_universe
.store_length
= putUChar
;
57 client_universe
.site_code_min
= 0;
58 client_universe
.end
= 0;
59 client_universe
.index
= universe_count
++;
60 universes
[client_universe
.index
] = &client_universe
;
61 if (!option_name_new_hash(&client_universe
.name_hash
,
62 CLIENT_HASH_SIZE
, MDL
) ||
63 !option_code_new_hash(&client_universe
.code_hash
,
64 CLIENT_HASH_SIZE
, MDL
))
65 log_fatal ("Can't allocate client option hash table.");
66 for (i
= 0 ; client_options
[i
].name
; i
++) {
67 option_code_hash_add(client_universe
.code_hash
,
68 &client_options
[i
].code
, 0,
69 &client_options
[i
], MDL
);
70 option_name_hash_add(client_universe
.name_hash
,
71 client_options
[i
].name
, 0,
72 &client_options
[i
], MDL
);
75 /* Add the client option space to the option space hash. */
76 universe_hash_add (universe_hash
,
77 client_universe
.name
, 0, &client_universe
, MDL
);
79 /* Make the client universe the configuration option universe. */
80 config_universe
= &client_universe
;