stables.c
来自「open source dhcp server client etc...」· C语言 代码 · 共 856 行 · 第 1/3 页
C
856 行
/* stables.c Tables of information only used by server... *//* * Copyright (c) 1995-2001 Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of The Internet Software Consortium nor the names * of its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This software has been written for the Internet Software Consortium * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc. * To learn more about the Internet Software Consortium, see * ``http://www.isc.org/''. To learn more about Vixie Enterprises, * see ``http://www.vix.com''. To learn more about Nominum, Inc., see * ``http://www.nominum.com''. */#ifndef lintstatic char copyright[] ="$Id: stables.c,v 1.25.2.3 2001/06/22 02:35:08 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";#endif /* not lint */#include "dhcpd.h"#if defined (FAILOVER_PROTOCOL)/* This is used to indicate some kind of failure when generating a failover option. */failover_option_t null_failover_option = { 0, 0 };failover_option_t skip_failover_option = { 0, 0 };/* Information about failover options, for printing, encoding and decoding. */struct failover_option_info ft_options [] ={ { 0, "unused", FT_UNDEF, 0, 0, 0 }, { FTO_BINDING_STATUS, "binding-status", FT_UINT8, 1, FM_OFFSET (binding_status), FTB_BINDING_STATUS }, { FTO_ASSIGNED_IP_ADDRESS, "assigned-IP-address", FT_IPADDR, 1, FM_OFFSET (assigned_addr), FTB_ASSIGNED_IP_ADDRESS }, { FTO_SERVER_ADDR, "sending-server-IP-address", FT_IPADDR, 1, FM_OFFSET (server_addr), FTB_SERVER_ADDR }, { FTO_ADDRESSES_TRANSFERRED, "addresses-transferred", FT_UINT32, 1, FM_OFFSET (addresses_transferred), FTB_ADDRESSES_TRANSFERRED }, { FTO_CLIENT_IDENTIFIER, "client-identifier", FT_BYTES, 0, FM_OFFSET (client_identifier), FTB_CLIENT_IDENTIFIER }, { FTO_CHADDR, "client-hardware-address", FT_BYTES, 0, FM_OFFSET (chaddr), FTB_CHADDR }, { FTO_DDNS, "DDNS", FT_DDNS, 1, FM_OFFSET (ddns), FTB_DDNS }, { FTO_REJECT_REASON, "reject-reason", FT_UINT8, 1, FM_OFFSET (reject_reason), FTB_REJECT_REASON }, { FTO_MESSAGE, "message", FT_TEXT, 0, FM_OFFSET (message), FTB_MESSAGE }, { FTO_MCLT, "MCLT", FT_UINT32, 1, FM_OFFSET (mclt), FTB_MCLT }, { FTO_VENDOR_CLASS, "vendor-class-identifier", FT_TEXT_OR_BYTES, 0, FM_OFFSET (vendor_class), FTB_VENDOR_CLASS }, { 12, "undefined", FT_UNDEF, 0, 0, 0 }, { FTO_LEASE_EXPIRY, "lease-expiration-time", FT_UINT32, 1, FM_OFFSET (expiry), FTB_LEASE_EXPIRY }, { FTO_POTENTIAL_EXPIRY, "potential-expiration-time", FT_UINT32, 1, FM_OFFSET (potential_expiry), FTB_POTENTIAL_EXPIRY }, { FTO_GRACE_EXPIRY, "grace-expiration-time", FT_UINT32, 1, FM_OFFSET (grace_expiry), FTB_GRACE_EXPIRY }, { FTO_CLTT, "client-last-transaction-time", FT_UINT32, 1, FM_OFFSET (client_ltt), FTB_CLTT }, { FTO_STOS, "start-time-of-state", FT_UINT32, 1, FM_OFFSET (stos), FTB_STOS }, { FTO_SERVER_STATE, "server-state", FT_UINT8, 1, FM_OFFSET (server_state), FTB_SERVER_STATE }, { FTO_SERVER_FLAGS, "server-flags", FT_UINT8, 1, FM_OFFSET (server_flags), FTB_SERVER_FLAGS }, { FTO_VENDOR_OPTIONS, "vendor-specific-options", FT_BYTES, 0, FM_OFFSET (vendor_options), FTB_VENDOR_OPTIONS }, { FTO_MAX_UNACKED, "max-unacked-bndupd", FT_UINT32, 1, FM_OFFSET (max_unacked), FTB_MAX_UNACKED }, { 22, "undefined", FT_UNDEF, 0, 0 }, { FTO_RECEIVE_TIMER, "receive-timer", FT_UINT32, 1, FM_OFFSET (receive_timer), FTB_RECEIVE_TIMER }, { FTO_HBA, "hash-bucket-assignment", FT_BYTES, 0, FM_OFFSET (hba), FTB_HBA }, { FTO_MESSAGE_DIGEST, "message-digest", FT_DIGEST, 0, 0, FTB_MESSAGE_DIGEST }, { FTO_PROTOCOL_VERSION, "protocol-version", FT_UINT8, 1, FM_OFFSET (protocol_version), FTB_PROTOCOL_VERSION }, { FTO_TLS_REQUEST, "TLS-request", FT_UINT8, 2, FM_OFFSET (tls_request), FTB_TLS_REQUEST }, { FTO_TLS_REPLY, "TLS-reply", FT_BYTES, 1, FM_OFFSET (tls_reply ), FTB_TLS_REPLY }, { FTO_REQUEST_OPTIONS, "client-request-options", FT_BYTES, 0, FM_OFFSET (request_options), FTB_REQUEST_OPTIONS }, { FTO_REPLY_OPTIONS, "client-reply-options", FT_BYTES, 0, FM_OFFSET (reply_options), FTB_REPLY_OPTIONS }};/* These are really options that make sense for a particular request - if some other option comes in, we're not going to use it, so we can just discard it. Note that the message-digest option is allowed for all message types, but is not saved - it's just used to validate the message and then discarded - so it's not mentioned here. */u_int32_t fto_allowed [] = { 0, /* 0 unused */ 0, /* 1 POOLREQ */ FTB_ADDRESSES_TRANSFERRED, /* 2 POOLRESP */ (FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS | FTB_CLIENT_IDENTIFIER | FTB_CHADDR | FTB_LEASE_EXPIRY | FTB_POTENTIAL_EXPIRY | FTB_STOS | FTB_CLTT | FTB_REQUEST_OPTIONS | FTB_REPLY_OPTIONS), /* 3 BNDUPD */ (FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS | FTB_CLIENT_IDENTIFIER | FTB_CHADDR | FTB_LEASE_EXPIRY | FTB_POTENTIAL_EXPIRY | FTB_STOS | FTB_CLTT | FTB_REQUEST_OPTIONS | FTB_REPLY_OPTIONS | FTB_REJECT_REASON | FTB_MESSAGE), /* 4 BNDACK */ (FTB_SERVER_ADDR | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER | FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REQUEST | FTB_MCLT | FTB_HBA), /* 5 CONNECT */ (FTB_SERVER_ADDR | FTB_MAX_UNACKED | FTB_RECEIVE_TIMER | FTB_VENDOR_CLASS | FTB_PROTOCOL_VERSION | FTB_TLS_REPLY | FTB_REJECT_REASON | FTB_MESSAGE), /* CONNECTACK */ 0, /* 7 UPDREQ */ 0, /* 8 UPDDONE */ 0, /* 9 UPDREQALL */ (FTB_SERVER_STATE | FTB_SERVER_FLAGS | FTB_STOS), /* 10 STATE */ 0, /* 11 CONTACT */ (FTB_REJECT_REASON | FTB_MESSAGE) /* 12 DISCONNECT */};/* Sizes of the various types. */int ft_sizes [] = { 1, /* FT_UINT8 */ 4, /* FT_IPADDR */ 4, /* FT_UINT32 */ 1, /* FT_BYTES */ 1, /* FT_TEXT_OR_BYTES */ 0, /* FT_DDNS */ 0, /* FT_DDNS1 */ 2, /* FT_UINT16 */ 1, /* FT_TEXT */ 0, /* FT_UNDEF */ 0, /* FT_DIGEST */};/* Names of the various failover link states. */const char *dhcp_flink_state_names [] = { "invalid state 0", "startup", "message length wait", "message wait", "disconnected"};#endif /* FAILOVER_PROTOCOL *//* Failover binding state names. These are used even if there is no failover protocol support. */const char *binding_state_names [] = { "free", "active", "expired", "released", "abandoned", "reset", "backup", "reserved", "bootp" };struct universe agent_universe;struct option agent_options [256] = { { "pad", "", &agent_universe, 0 }, { "circuit-id", "X", &agent_universe, 1 }, { "remote-id", "X", &agent_universe, 2 }, { "agent-id", "I", &agent_universe, 3 }, { "#4", "X", &agent_universe, 4 }, { "#5", "X", &agent_universe, 5 }, { "#6", "X", &agent_universe, 6 }, { "#7", "X", &agent_universe, 7 }, { "#8", "X", &agent_universe, 8 }, { "#9", "X", &agent_universe, 9 }, { "#10", "X", &agent_universe, 10 }, { "#11", "X", &agent_universe, 11 }, { "#12", "X", &agent_universe, 12 }, { "#13", "X", &agent_universe, 13 }, { "#14", "X", &agent_universe, 14 }, { "#15", "X", &agent_universe, 15 }, { "#16", "X", &agent_universe, 16 }, { "#17", "X", &agent_universe, 17 }, { "#18", "X", &agent_universe, 18 }, { "#19", "X", &agent_universe, 19 }, { "#20", "X", &agent_universe, 20 }, { "#21", "X", &agent_universe, 21 }, { "#22", "X", &agent_universe, 22 }, { "#23", "X", &agent_universe, 23 }, { "#24", "X", &agent_universe, 24 }, { "#25", "X", &agent_universe, 25 }, { "#26", "X", &agent_universe, 26 }, { "#27", "X", &agent_universe, 27 }, { "#28", "X", &agent_universe, 28 }, { "#29", "X", &agent_universe, 29 }, { "#30", "X", &agent_universe, 30 }, { "#31", "X", &agent_universe, 31 }, { "#32", "X", &agent_universe, 32 }, { "#33", "X", &agent_universe, 33 }, { "#34", "X", &agent_universe, 34 }, { "#35", "X", &agent_universe, 35 }, { "#36", "X", &agent_universe, 36 }, { "#37", "X", &agent_universe, 37 }, { "#38", "X", &agent_universe, 38 }, { "#39", "X", &agent_universe, 39 }, { "#40", "X", &agent_universe, 40 }, { "#41", "X", &agent_universe, 41 }, { "#42", "X", &agent_universe, 42 }, { "#43", "X", &agent_universe, 43 }, { "#44", "X", &agent_universe, 44 }, { "#45", "X", &agent_universe, 45 }, { "#46", "X", &agent_universe, 46 }, { "#47", "X", &agent_universe, 47 }, { "#48", "X", &agent_universe, 48 }, { "#49", "X", &agent_universe, 49 }, { "#50", "X", &agent_universe, 50 }, { "#51", "X", &agent_universe, 51 }, { "#52", "X", &agent_universe, 52 }, { "#53", "X", &agent_universe, 53 }, { "#54", "X", &agent_universe, 54 }, { "#55", "X", &agent_universe, 55 }, { "#56", "X", &agent_universe, 56 }, { "#57", "X", &agent_universe, 57 }, { "#58", "X", &agent_universe, 58 }, { "#59", "X", &agent_universe, 59 }, { "#60", "X", &agent_universe, 60 }, { "#61", "X", &agent_universe, 61 }, { "#62", "X", &agent_universe, 62 }, { "#63", "X", &agent_universe, 63 }, { "#64", "X", &agent_universe, 64 }, { "#65", "X", &agent_universe, 65 }, { "#66", "X", &agent_universe, 66 }, { "#67", "X", &agent_universe, 67 }, { "#68", "X", &agent_universe, 68 }, { "#69", "X", &agent_universe, 69 }, { "#70", "X", &agent_universe, 70 }, { "#71", "X", &agent_universe, 71 }, { "#72", "X", &agent_universe, 72 }, { "#73", "X", &agent_universe, 73 }, { "#74", "X", &agent_universe, 74 }, { "#75", "X", &agent_universe, 75 }, { "#76", "X", &agent_universe, 76 }, { "#77", "X", &agent_universe, 77 }, { "#78", "X", &agent_universe, 78 }, { "#79", "X", &agent_universe, 79 }, { "#80", "X", &agent_universe, 80 }, { "#81", "X", &agent_universe, 81 }, { "#82", "X", &agent_universe, 82 }, { "#83", "X", &agent_universe, 83 }, { "#84", "X", &agent_universe, 84 }, { "#85", "X", &agent_universe, 85 }, { "#86", "X", &agent_universe, 86 }, { "#87", "X", &agent_universe, 87 }, { "#88", "X", &agent_universe, 88 }, { "#89", "X", &agent_universe, 89 }, { "#90", "X", &agent_universe, 90 }, { "#91", "X", &agent_universe, 91 }, { "#92", "X", &agent_universe, 92 }, { "#93", "X", &agent_universe, 93 }, { "#94", "X", &agent_universe, 94 }, { "#95", "X", &agent_universe, 95 }, { "#96", "X", &agent_universe, 96 }, { "#97", "X", &agent_universe, 97 }, { "#98", "X", &agent_universe, 98 },
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?