[BACK]Return to client_tables.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / external / mpl / dhcp / dist / client

Annotation of src/external/mpl/dhcp/dist/client/client_tables.c, Revision 1.1

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

CVSweb <webmaster@jp.NetBSD.org>