1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef AGENT_H 27 #define AGENT_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #include <sys/types.h> 32 #include <libinetutil.h> 33 34 /* 35 * agent.h contains general symbols that should be available to all 36 * source programs that are part of the agent. in general, files 37 * specific to a given collection of code (such as interface.h or 38 * dhcpmsg.h) are to be preferred to this dumping ground. use only 39 * when necessary. 40 */ 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 /* 47 * global variables: `tq' and `eh' represent the global timer queue 48 * and event handler, as described in the README. `class_id' is our 49 * vendor class id set early on in main(). `inactivity_id' is the 50 * timer id of the global inactivity timer, which shuts down the agent 51 * if there are no interfaces to manage for DHCP_INACTIVITY_WAIT 52 * seconds. `grandparent' is the pid of the original process when in 53 * adopt mode. 54 */ 55 56 extern iu_tq_t *tq; 57 extern iu_eh_t *eh; 58 extern char *class_id; 59 extern int class_id_len; 60 extern iu_timer_id_t inactivity_id; 61 extern pid_t grandparent; 62 63 boolean_t drain_script(iu_eh_t *, void *); 64 65 /* 66 * global tunable parameters. an `I' in the preceding comment indicates 67 * an implementation artifact; a `R' in the preceding comment indicates 68 * that the value was suggested (or required) by RFC2131. 69 */ 70 71 /* I: how many seconds to wait before restarting DHCP on an interface */ 72 #define DHCP_RESTART_WAIT 10 73 74 /* 75 * I: the maximum number of milliseconds to wait before SELECTING on an 76 * interface. RFC2131 recommends a random wait of between one and ten seconds, 77 * to speed up DHCP at boot we wait between zero and two seconds. 78 */ 79 #define DHCP_SELECT_WAIT 2000 80 81 /* R: how many seconds before lease expiration we give up trying to rebind */ 82 #define DHCP_REBIND_MIN 60 83 84 /* I: seconds to wait retrying dhcp_expire() if uncancellable async event */ 85 #define DHCP_EXPIRE_WAIT 10 86 87 /* R: approximate percentage of lease time to wait until RENEWING state */ 88 #define DHCP_T1_FACT .5 89 90 /* R: approximate percentage of lease time to wait until REBINDING state */ 91 #define DHCP_T2_FACT .875 92 93 /* I: number of REQUEST attempts before assuming something is awry */ 94 #define DHCP_MAX_REQUESTS 4 95 96 /* I: epsilon in seconds used to check if old and new lease times are same */ 97 #define DHCP_LEASE_EPS 30 98 99 /* I: if lease is not being extended, seconds left before alerting user */ 100 #define DHCP_LEASE_ERROR_THRESH (60*60) /* one hour */ 101 102 /* I: how many seconds before bailing out if there's no work to do */ 103 #define DHCP_INACTIVITY_WAIT (60*3) /* three minutes */ 104 105 /* I: the maximum amount of seconds we use an adopted lease */ 106 #define DHCP_ADOPT_LEASE_MAX (60*60) /* one hour */ 107 108 /* I: number of seconds grandparent waits for child to finish adoption. */ 109 #define DHCP_ADOPT_SLEEP 30 110 111 /* I: the maximum amount of milliseconds to wait for an ipc request */ 112 #define DHCP_IPC_REQUEST_WAIT (3*1000) /* three seconds */ 113 114 /* 115 * reasons for why iu_handle_events() returned 116 */ 117 enum { DHCP_REASON_INACTIVITY, DHCP_REASON_SIGNAL, DHCP_REASON_TERMINATE }; 118 119 #ifdef __cplusplus 120 } 121 #endif 122 123 #endif /* AGENT_H */ 124