ISC DHCP  4.4.2b1
A reference DHCPv4 and DHCPv6 implementation
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 by 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  * 950 Charter Street
22  * Redwood City, CA 94063
23  * <info@isc.org>
24  * https://www.isc.org/
25  *
26  */
27 
28 #include "dhcpd.h"
29 
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 }
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 ... */
58  client_universe.end = 0;
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 }
universe::index
int index
Definition: tree.h:339
config_universe
struct universe * config_universe
Definition: tables.c:979
log_fatal
void log_fatal(const char *,...) __attribute__((__format__(__printf__
delete_hashed_option
void delete_hashed_option(struct universe *universe, struct option_state *options, int code)
Definition: options.c:2918
universe::encapsulate
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
dhcpd.h
universe::concat_duplicates
int concat_duplicates
Definition: tree.h:342
universe::tag_size
int tag_size
Definition: tree.h:334
universes
struct universe ** universes
Definition: tables.c:972
hashed_option_state_dereference
int hashed_option_state_dereference(struct universe *universe, struct option_state *state, const char *file, int line)
Definition: options.c:3003
universe_hash
universe_hash_t * universe_hash
Definition: tables.c:971
hashed_option_space_encapsulate
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
universe
Definition: tree.h:301
option::code
unsigned code
Definition: tree.h:349
universe::name
const char * name
Definition: tree.h:302
save_hashed_option
void save_hashed_option(struct universe *universe, struct option_state *options, struct option_cache *oc, isc_boolean_t appendp)
Definition: options.c:2839
putUChar
void putUChar(unsigned char *, u_int32_t)
Definition: convert.c:102
universe::option_state_dereference
int(* option_state_dereference)(struct universe *, struct option_state *, const char *, int)
Definition: tree.h:320
MDL
#define MDL
Definition: omapip.h:567
hashed_option_space_foreach
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
universe::length_size
int length_size
Definition: tree.h:334
universe::site_code_min
unsigned site_code_min
Definition: tree.h:335
universe::end
unsigned end
Definition: tree.h:335
universe::save_func
void(* save_func)(struct universe *, struct option_state *, struct option_cache *, isc_boolean_t)
Definition: tree.h:306
option::name
const char * name
Definition: tree.h:346
universe_count
int universe_count
Definition: tables.c:973
client_universe
struct universe client_universe
Definition: client_tables.c:30
universe::delete_func
void(* delete_func)(struct universe *universe, struct option_state *, int)
Definition: tree.h:318
lookup_hashed_option
struct option_cache * lookup_hashed_option(struct universe *universe, struct option_state *options, unsigned code)
Definition: options.c:2518
option
Definition: tree.h:345
universe::store_length
void(* store_length)(unsigned char *, u_int32_t)
Definition: tree.h:333
universe::lookup_func
struct option_cache *(* lookup_func)(struct universe *, struct option_state *, unsigned)
Definition: tree.h:303
initialize_client_option_spaces
void initialize_client_option_spaces()
Definition: client_tables.c:39
universe::name_hash
option_name_hash_t * name_hash
Definition: tree.h:336
CLIENT_HASH_SIZE
#define CLIENT_HASH_SIZE
Definition: client_tables.c:37
universe::foreach
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
universe::store_tag
void(* store_tag)(unsigned char *, u_int32_t)
Definition: tree.h:331
universe::code_hash
option_code_hash_t * code_hash
Definition: tree.h:337