ISC DHCP 4.4.3-P1
A reference DHCPv4 and DHCPv6 implementation
 
Loading...
Searching...
No Matches
client_tables.c
Go to the documentation of this file.
1/* client_tables.c
2
3 Tables of information only used by client... */
4
5/*
6 * Copyright (C) 2017-2022 Internet Systems Consortium, Inc. ("ISC")
7 *
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/.
11 *
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.
19 *
20 * Internet Systems Consortium, Inc.
21 * PO Box 360
22 * Newmarket, NH 03857 USA
23 * <info@isc.org>
24 * https://www.isc.org/
25 *
26 */
27
28#include "dhcpd.h"
29
31static 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 }
35};
36
37#define CLIENT_HASH_SIZE (2*(sizeof(client_options) / sizeof(struct option)))
38
40{
41 int i;
42
43 /* Set up the client option universe... */
44 client_universe.name = "client";
53 client_universe.length_size = 1; /* Never used ... */
61 if (!option_name_new_hash(&client_universe.name_hash,
63 !option_code_new_hash(&client_universe.code_hash,
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);
73 }
74
75 /* Add the client option space to the option space hash. */
76 universe_hash_add (universe_hash,
78
79 /* Make the client universe the configuration option universe. */
81}
#define CLIENT_HASH_SIZE
Definition: client_tables.c:37
void initialize_client_option_spaces()
Definition: client_tables.c:39
struct universe client_universe
Definition: client_tables.c:30
void save_hashed_option(struct universe *universe, struct option_state *options, struct option_cache *oc, isc_boolean_t appendp)
Definition: options.c:2839
int hashed_option_space_encapsulate(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *universe)
Definition: options.c:3249
int hashed_option_state_dereference(struct universe *universe, struct option_state *state, const char *file, int line)
Definition: options.c:3003
void hashed_option_space_foreach(struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct universe *u, void *stuff, void(*func)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *))
Definition: options.c:3832
struct option_cache * lookup_hashed_option(struct universe *universe, struct option_state *options, unsigned code)
Definition: options.c:2518
void delete_hashed_option(struct universe *universe, struct option_state *options, int code)
Definition: options.c:2918
void putUChar(unsigned char *, u_int32_t)
Definition: convert.c:102
#define MDL
Definition: omapip.h:567
void log_fatal(const char *,...) __attribute__((__format__(__printf__
Definition: tree.h:345
unsigned code
Definition: tree.h:349
const char * name
Definition: tree.h:346
Definition: tree.h:301
void(* store_length)(unsigned char *, u_int32_t)
Definition: tree.h:333
int tag_size
Definition: tree.h:334
void(* save_func)(struct universe *, struct option_state *, struct option_cache *, isc_boolean_t)
Definition: tree.h:306
int(* encapsulate)(struct data_string *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *)
Definition: tree.h:325
void(* store_tag)(unsigned char *, u_int32_t)
Definition: tree.h:331
int index
Definition: tree.h:339
int(* option_state_dereference)(struct universe *, struct option_state *, const char *, int)
Definition: tree.h:320
void(* delete_func)(struct universe *universe, struct option_state *, int)
Definition: tree.h:318
option_name_hash_t * name_hash
Definition: tree.h:336
unsigned site_code_min
Definition: tree.h:335
int concat_duplicates
Definition: tree.h:342
option_code_hash_t * code_hash
Definition: tree.h:337
int length_size
Definition: tree.h:334
void(* foreach)(struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *, void(*)(struct option_cache *, struct packet *, struct lease *, struct client_state *, struct option_state *, struct option_state *, struct binding_scope **, struct universe *, void *))
Definition: tree.h:308
const char * name
Definition: tree.h:302
unsigned end
Definition: tree.h:335
struct option_cache *(* lookup_func)(struct universe *, struct option_state *, unsigned)
Definition: tree.h:303
struct universe * config_universe
Definition: tables.c:982
int universe_count
Definition: tables.c:976
universe_hash_t * universe_hash
Definition: tables.c:974
struct universe ** universes
Definition: tables.c:975