8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / cmd-inet / sbin / dhcpagent / script_handler.h
blob63421d5f9976e4332c75134611ab8c3369540811
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef SCRIPT_HANDLER_H
27 #define SCRIPT_HANDLER_H
29 #include "common.h"
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
36 * The signal SIGTERM is sent to a script process if it does not exit after
37 * SCRIPT_TIMEOUT seconds; and the signal SIGKILL is sent if it is still alive
38 * SCRIPT_TIMEOUT_GRACE seconds after SIGTERM is sent. (SCRIPT_TIMEOUT +
39 * SCRIPT_TIMEOUT_GRACE) should be less than DHCP_ASYNC_WAIT.
41 #define SCRIPT_TIMEOUT 55
42 #define SCRIPT_TIMEOUT_GRACE 3
45 * script exit status as dhcpagent sees it, for debug purpose only.
47 * SCRIPT_OK: script exits ok, no timeout
48 * SCRIPT_KILLED: script timeout, killed
49 * SCRIPT_FAILED: unknown status
52 enum { SCRIPT_OK, SCRIPT_KILLED, SCRIPT_FAILED };
55 * event names for script.
57 #define EVENT_BOUND "BOUND"
58 #define EVENT_EXTEND "EXTEND"
59 #define EVENT_EXPIRE "EXPIRE"
60 #define EVENT_DROP "DROP"
61 #define EVENT_INFORM "INFORM"
62 #define EVENT_RELEASE "RELEASE"
64 #define EVENT_BOUND6 "BOUND6"
65 #define EVENT_EXTEND6 "EXTEND6"
66 #define EVENT_EXPIRE6 "EXPIRE6"
67 #define EVENT_DROP6 "DROP6"
68 #define EVENT_INFORM6 "INFORM6"
69 #define EVENT_LOSS6 "LOSS6"
70 #define EVENT_RELEASE6 "RELEASE6"
73 * script location.
75 #define SCRIPT_PATH "/etc/dhcp/eventhook"
78 * the number of running scripts.
80 extern unsigned int script_count;
82 void script_init(dhcp_smach_t *);
83 boolean_t script_start(dhcp_smach_t *, const char *, script_callback_t *,
84 void *, int *);
85 void script_stop(dhcp_smach_t *);
87 #ifdef __cplusplus
89 #endif
91 #endif /* SCRIPT_HANDLER_H */